From: Billie Alsup Date: Sat, 7 Dec 2024 07:42:38 +0000 (+0000) Subject: DHCP: reduce buflen by 2 when creating a new RFC 3396 option X-Git-Tag: v10.2.0~29 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f303ab474494b8ad4889d69df76309eba282efb;p=thirdparty%2Fdhcpcd.git DHCP: reduce buflen by 2 when creating a new RFC 3396 option Fixes #418 and potential buffer overflow. --- diff --git a/src/dhcp.c b/src/dhcp.c index 11c69bc1..9e23ab62 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -752,6 +752,7 @@ rfc3396_write(struct rfc3396_ctx *ctx, void *data, size_t len) *(*ctx->buf)++ = ctx->code; ctx->len = (*ctx->buf)++; *ctx->len = 0; + ctx->buflen -= 2; r += 2; }