]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
hack until we track down places which don't set data.enumv = vp->da
authorAlan T. DeKok <aland@freeradius.org>
Fri, 27 Nov 2020 13:07:14 +0000 (08:07 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 27 Nov 2020 13:07:45 +0000 (08:07 -0500)
src/lib/util/struct.c
src/protocols/dhcpv6/encode.c

index b97cffc00abe58fcdc3b74ca8ac7ce5768f9a1a2..5524d8997467a6236314b2d7329072b9ae2b8928 100644 (file)
@@ -598,15 +598,15 @@ ssize_t fr_struct_to_network_dbuff(fr_dbuff_t *dbuff,
 
                } else {
                        /*
-                        *      Encode fixed-size octets fields so that they
-                        *      are exactly the fixed size, UNLESS the entire
-                        *      output is truncated.
+                        *      Hack until we find all places that don't set data.enumv
                         */
-#ifndef NDEBUG
-                       if ((vp->da->type == FR_TYPE_OCTETS) && vp->da->flags.length) {
-                               fr_assert(vp->data.enumv == vp->da);
+                       if (vp->da->flags.length && (vp->data.enumv != vp->da)) {
+                               fr_dict_attr_t const * const *c = &vp->data.enumv;
+                               fr_dict_attr_t **u;
+
+                               memcpy(&u, &c, sizeof(c)); /* const issues */
+                               memcpy(u, &vp->da, sizeof(vp->da));                     
                        }
-#endif
 
                        /*
                         *      Determine the nested type and call the appropriate encoder
index ae3216e75a8e784bfc2f393b9b4413121ea62daf..0c6bff43e8433ed2fac3e4e2c0d9af6b47735ce2 100644 (file)
@@ -389,7 +389,16 @@ static ssize_t encode_value(fr_dbuff_t *dbuff,
         */
        to_network:
        case FR_TYPE_OCTETS:
-               fr_assert(!vp->da->flags.length || (vp->data.enumv == vp->da));
+               /*
+                *      Hack until we find all places that don't set data.enumv
+                */
+               if (vp->da->flags.length && (vp->data.enumv != vp->da)) {
+                       fr_dict_attr_t const * const *c = &vp->data.enumv;
+                       fr_dict_attr_t **u;
+
+                       memcpy(&u, &c, sizeof(c)); /* const issues */
+                       memcpy(u, &vp->da, sizeof(vp->da));                     
+               }
                FALL_THROUGH;
 
        /*