]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't loop over values for VSAs
authorAlan T. DeKok <aland@freeradius.org>
Fri, 11 Mar 2022 13:16:39 +0000 (08:16 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 11 Mar 2022 15:41:08 +0000 (10:41 -0500)
src/protocols/dhcpv4/encode.c

index 50c60d71adaa3f2581cab5c1bd62e5e7e27366a7..3741030915d4b62d558eecb7689a2c42119b4dc2 100644 (file)
@@ -405,15 +405,24 @@ static ssize_t encode_rfc_hdr(fr_dbuff_t *dbuff,
        if (da->flags.array) {
                len = encode_array(&work_dbuff, da_stack, depth, cursor, encode_ctx);
                if (len < 0) return -1;
-       } else {
+
+       } else if (da->parent && (da->parent->type != FR_TYPE_VENDOR)) {
                fr_pair_t *vp;
-               
+
                do {
                        len = encode_value(&work_dbuff, da_stack, depth, cursor, encode_ctx);
                        if (len < 0) return len; /* @todo return the correct offset, but whatever */
 
                        vp = fr_dcursor_current(cursor);
                } while (vp && (vp->da == da));
+
+       } else {
+               /*
+                *      For VSAs, each vendor value is prefixed by an 8-bit length, so we don't loop over the
+                *      input pairs.
+                */
+               len = encode_value(&work_dbuff, da_stack, depth, cursor, encode_ctx);
+               if (len < 0) return len; /* @todo return the correct offset, but whatever */
        }
 
        len = fr_dbuff_used(&work_dbuff) - 2;