]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
tweak "cast to same type" to not do bad things
authorAlan T. DeKok <aland@freeradius.org>
Thu, 18 Dec 2025 16:57:24 +0000 (17:57 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 19 Dec 2025 11:57:45 +0000 (12:57 +0100)
if no enumv is passed in, it shouldn't forcibly nuke the input
enumv.  This patch makes it easier to deal with FR_TYPE_ATTR

src/lib/util/value.c

index 8032fca00c30e86585433d4edbb8dcd9bb8978ac..2f86f21b57a96eb3f6918b23a4a8bd07c3336524 100644 (file)
@@ -3763,7 +3763,7 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst,
                ret = fr_value_box_copy(ctx, dst, src);
                if (ret < 0) return ret;
 
-               dst->enumv = dst_enumv;
+               if (dst_enumv) dst->enumv = dst_enumv;
 
                return ret;
        }