]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Assert that *out isn't set if the substr parsers return an error
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 25 Oct 2021 18:17:19 +0000 (14:17 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 25 Oct 2021 18:17:19 +0000 (14:17 -0400)
src/lib/server/tmpl_tokenize.c

index d3bf4d61ac22352b62b5542b8fde4a0bb2ca269e..24a6acd8445c4984e3f2174ceda82b53e787962f 100644 (file)
@@ -2545,12 +2545,14 @@ ssize_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out,
 
                        return fr_sbuff_set(in, &our_in);
                }
+               fr_assert(!*out);
 
                /*
                 *      See if it's an octets string
                 */
                slen = tmpl_afrom_octets_substr(ctx, out, &our_in, p_rules);
                if (slen > 0) goto done_bareword;
+               fr_assert(!*out);
 
                /*
                 *      See if it's a mac address
@@ -2561,18 +2563,21 @@ ssize_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out,
                 */
                slen = tmpl_afrom_ether_substr(ctx, out, &our_in, p_rules);
                if (slen > 0) goto done_bareword;
+               fr_assert(!*out);
 
                /*
                 *      See if it's an IPv4 address or prefix
                 */
                slen = tmpl_afrom_ipv4_substr(ctx, out, &our_in, p_rules);
                if (slen > 0) goto done_bareword;
+               fr_assert(!*out);
 
                /*
                 *      See if it's an IPv6 address or prefix
                 */
                slen = tmpl_afrom_ipv6_substr(ctx, out, &our_in, p_rules);
                if (slen > 0) goto done_bareword;
+               fr_assert(!*out);
 
                /*
                 *      See if it's a float
@@ -2586,6 +2591,7 @@ ssize_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out,
                 */
                slen = tmpl_afrom_integer_substr(ctx, out, &our_in, p_rules);
                if (slen > 0) goto done_bareword;
+               fr_assert(!*out);
 
                /*
                 *      See if it's an attribute reference
@@ -2593,6 +2599,7 @@ ssize_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out,
                 */
                slen = tmpl_afrom_attr_substr(ctx, NULL, out, &our_in, p_rules, t_rules);
                if (slen > 0) goto done_bareword;
+               fr_assert(!*out);
 
                vpt = tmpl_alloc_null(ctx);