]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move assert to before value-box alloc
authorAlan T. DeKok <aland@freeradius.org>
Sat, 19 Nov 2022 12:38:53 +0000 (07:38 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 21 Nov 2022 15:51:10 +0000 (10:51 -0500)
because structural VPs are very different from structural
value-boxes.

So we should never create a structural value-box in a situation
where the intent is to use VPs

src/lib/server/tmpl_eval.c

index 2191cfab2c94753973b1afe1883c8964f41edc38..1fa9605fb72e65209073b5bb76e85151b7e9ddaa 100644 (file)
@@ -1424,10 +1424,11 @@ int tmpl_eval_pair(TALLOC_CTX *ctx, FR_DLIST_HEAD(fr_value_box_list) *out, reque
                break;
 
        default:
+               fr_assert(fr_type_is_leaf(vp->da->type));
+
                value = fr_value_box_alloc(ctx, vp->data.type, vp->da, vp->data.tainted);
                if (!value) goto oom;
 
-               fr_assert(fr_type_is_leaf(vp->da->type));
                fr_value_box_copy(value, value, &vp->data);     /* Also dups taint */
                fr_value_box_list_insert_tail(&list, value);
                break;