From: Alan T. DeKok Date: Sat, 19 Nov 2022 12:38:53 +0000 (-0500) Subject: move assert to before value-box alloc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd71c67c97e5edf6ca34ac217c65cd272f1268ba;p=thirdparty%2Ffreeradius-server.git move assert to before value-box alloc 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 --- diff --git a/src/lib/server/tmpl_eval.c b/src/lib/server/tmpl_eval.c index 2191cfab2c9..1fa9605fb72 100644 --- a/src/lib/server/tmpl_eval.c +++ b/src/lib/server/tmpl_eval.c @@ -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;