summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2007-10-19 15:52:20 +0000
committerkrw <krw@openbsd.org>2007-10-19 15:52:20 +0000
commitb96d5e27772e99494d264ef4404a77d0410ba966 (patch)
treefeb67e6ea9dcf86f49b2951a832bcbb0ede72e7d
parentBe a bit more paranoid and initialize all valid options buffers with (diff)
downloadwireguard-openbsd-b96d5e27772e99494d264ef4404a77d0410ba966.tar.xz
wireguard-openbsd-b96d5e27772e99494d264ef4404a77d0410ba966.zip
Make sure bufix is updated after copying options into the first overflow
buffer. Actually use the second overflow buffer now that bufix is correct and the test for remaining options will work correctly. ok beck@
-rw-r--r--usr.sbin/dhcpd/options.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/options.c b/usr.sbin/dhcpd/options.c
index fc99d2a215e..112900f4816 100644
--- a/usr.sbin/dhcpd/options.c
+++ b/usr.sbin/dhcpd/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.13 2007/10/19 15:43:33 krw Exp $ */
+/* $OpenBSD: options.c,v 1.14 2007/10/19 15:52:20 krw Exp $ */
/* DHCP options parsing and reassembly. */
@@ -328,6 +328,7 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
memcpy(outpacket->file,
&buffer[bufix], option_size - bufix);
mainbufix = option_size - bufix;
+ bufix = option_size;
if (mainbufix < DHCP_FILE_LEN)
outpacket->file[mainbufix++] = (char)DHO_END;
} else {
@@ -336,7 +337,7 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
bufix += DHCP_FILE_LEN;
}
}
- if ((overload & 2) && option_size < bufix) {
+ if ((overload & 2) && option_size > bufix) {
memcpy(outpacket->sname,
&buffer[bufix], option_size - bufix);