]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
update messages and fix coverity issues
authorAlan T. DeKok <aland@freeradius.org>
Tue, 18 Mar 2025 02:58:33 +0000 (09:58 +0700)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 18 Mar 2025 02:58:33 +0000 (09:58 +0700)
src/lib/unlang/xlat_expr.c
src/lib/unlang/xlat_tokenize.c
src/tests/unit/xlat/alternation.txt
src/tests/unit/xlat/base.txt

index 75ebc1390600e6c0e9245177afe4670f4c6a98f0..2a530461345d46ddcc63a3f4d40fdb08ea3a1700 100644 (file)
@@ -3298,6 +3298,11 @@ fr_slen_t xlat_tokenize_expression(TALLOC_CTX *ctx, xlat_exp_head_t **out, fr_sb
        slen = xlat_tokenize_expression_internal(ctx, out, in, p_rules, t_rules, false);
        if (slen < 0) return slen;
 
+       if (!*out) {
+               fr_strerror_const("Empty expressions are invalid");
+               return -1;
+       }
+
        if (xlat_finalize(*out, t_rules->xlat.runtime_el) < 0) {
                TALLOC_FREE(*out);
                return -1;
@@ -3314,6 +3319,11 @@ fr_slen_t xlat_tokenize_condition(TALLOC_CTX *ctx, xlat_exp_head_t **out, fr_sbu
        slen = xlat_tokenize_expression_internal(ctx, out, in, p_rules, t_rules, true);
        if (slen < 0) return slen;
 
+       if (!*out) {
+               fr_strerror_const("Empty conditions are invalid");
+               return -1;
+       }
+
        if (xlat_finalize(*out, t_rules->xlat.runtime_el) < 0) {
                TALLOC_FREE(*out);
                return -1;
index aec56b918020e5104fcb0c7134c461fcc0da97ca..b6c6195221ee1ff7873d8c4a2d8906bc80f85a2e 100644 (file)
@@ -751,7 +751,7 @@ check_for_attr:
                switch (hint) {
                case '}':
                empty_disallowed:
-                       fr_strerror_const("Empty expression is invalid");
+                       fr_strerror_const("Empty expressions are invalid");
                        return -1;
 
                case '[':
index 2772c5d3c73ae8bcfcb40ff139af547d9830a4c9..83c93c4d0f88cd087c6edbf6d6cd4c95234a0369 100644 (file)
@@ -39,10 +39,10 @@ xlat %{ || %{User-Name}}
 match ERROR offset 4: Zero length attribute name: Unresolved attributes are not allowed here
 
 xlat %{%{} || }
-match ERROR offset 5: Empty expression is invalid
+match ERROR offset 5: Empty expressions are invalid
 
 xlat %{%{} || foo}
-match ERROR offset 5: Empty expression is invalid
+match ERROR offset 5: Empty expressions are invalid
 
 xlat %{%{User-Name} || 
 match ERROR offset 19: Empty attribute reference
index 95f62d45747f84b003c09c6f8127298c62100744..ce134816fbd7b05634396c53d0826aff3d63fdc0 100644 (file)
@@ -158,7 +158,7 @@ xlat %{
 match ERROR offset 3: Missing closing brace
 
 xlat %{}
-match ERROR offset 3: Empty expression is invalid
+match ERROR offset 3: Empty expressions are invalid
 
 xlat %{:}
 match ERROR offset 3: Zero length attribute name: Unresolved attributes are not allowed here