]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
copy the string values, instead of shallow copies
authorAlan T. DeKok <aland@freeradius.org>
Tue, 30 Nov 2021 14:05:03 +0000 (09:05 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 30 Nov 2021 14:05:03 +0000 (09:05 -0500)
we're not allowing multiple refcounts for the same string, so
the simplest solution is to just copy it whole-sale.

src/lib/util/edit.c

index c59c89092b434b8507ce52fe5a8a7ae7782e71c1..080f9d6bdc606bbdb83ad8aeb10f54873b8bf93e 100644 (file)
@@ -106,7 +106,7 @@ static int edit_undo(fr_edit_t *e)
        case FR_EDIT_VALUE:
                fr_assert(fr_type_is_leaf(vp->vp_type));
                if (!fr_type_is_fixed_size(vp->vp_type)) fr_value_box_clear(&vp->data);
-               fr_value_box_copy_shallow(NULL, &vp->data, &e->data);
+               fr_value_box_copy(vp, &vp->data, &e->data);
                break;
 
        case FR_EDIT_CLEAR:
@@ -360,10 +360,7 @@ static int edit_record(fr_edit_list_t *el, fr_edit_op_t op, fr_pair_t *vp, fr_pa
                fr_assert(ref == NULL);
 
                fr_assert(fr_type_is_leaf(vp->vp_type));
-               fr_value_box_copy_shallow(NULL, &e->data, &vp->data);
-               if (!fr_type_is_fixed_size(vp->vp_type)) fr_value_box_memdup_shallow(&vp->data, vp->data.enumv,
-                                                                                    e->data.vb_octets, e->data.vb_length,
-                                                                                    e->data.tainted);
+               fr_value_box_copy(e, &e->data, &vp->data);
                break;
 
        case FR_EDIT_CLEAR: