]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
hackity hack, until such time as we fix xlat_copy()
authorAlan T. DeKok <aland@freeradius.org>
Mon, 10 Mar 2025 02:42:53 +0000 (22:42 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 10 Mar 2025 02:42:53 +0000 (22:42 -0400)
because xlat_copy() expects its output to exist

src/lib/server/tmpl_tokenize.c

index a3433b09f950c24e9dcf954107a9c1f986b3f569..9579bee4f2a077eded99bd86c13ded0dc175713b 100644 (file)
@@ -39,6 +39,11 @@ RCSID("$Id$")
 #include <freeradius-devel/util/sbuff.h>
 #include <freeradius-devel/util/value.h>
 
+/*
+ *     For xlat_exp_head_alloc(), because xlat_copy() doesn't create an output head.
+ */
+#include <freeradius-devel/unlang/xlat_priv.h>
+
 #include <ctype.h>
 
 /*
@@ -3667,6 +3672,9 @@ tmpl_t *tmpl_copy(TALLOC_CTX *ctx, tmpl_t const *in)
        } else if (tmpl_contains_xlat(vpt)) {
                fr_assert(in->data.xlat.ex != NULL);
 
+               vpt->data.xlat.ex = xlat_exp_head_alloc(vpt);
+               if (!vpt->data.xlat.ex) goto error;
+
                if (unlikely(xlat_copy(vpt, vpt->data.xlat.ex, in->data.xlat.ex) < 0)) goto error;
 
        } else if (tmpl_is_data(vpt)) {