From: Alan T. DeKok Date: Fri, 11 Mar 2022 13:16:39 +0000 (-0500) Subject: don't loop over values for VSAs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d223074d0deec1fe4d1e158be89c9fc0d60f3741;p=thirdparty%2Ffreeradius-server.git don't loop over values for VSAs --- diff --git a/src/protocols/dhcpv4/encode.c b/src/protocols/dhcpv4/encode.c index 50c60d71ada..3741030915d 100644 --- a/src/protocols/dhcpv4/encode.c +++ b/src/protocols/dhcpv4/encode.c @@ -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;