Skip to content

Commit 0f303ab

Browse files
billie-alsuprsmarples
authored andcommitted
DHCP: reduce buflen by 2 when creating a new RFC 3396 option
Fixes #418 and potential buffer overflow.
1 parent 371c7c6 commit 0f303ab

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/dhcp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ rfc3396_write(struct rfc3396_ctx *ctx, void *data, size_t len)
752752
*(*ctx->buf)++ = ctx->code;
753753
ctx->len = (*ctx->buf)++;
754754
*ctx->len = 0;
755+
ctx->buflen -= 2;
755756
r += 2;
756757
}
757758

0 commit comments

Comments
 (0)