From: Roy Marples Date: Thu, 29 Jan 2009 13:56:23 +0000 (+0000) Subject: Just terminate the DHCP message if not terminated. DHO_PAD could be valid data. X-Git-Tag: v5.0.0~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ac6a5d2f9b7955e9316cd85a9717132354f4423;p=thirdparty%2Fdhcpcd.git Just terminate the DHCP message if not terminated. DHO_PAD could be valid data. --- diff --git a/dhcpcd.c b/dhcpcd.c index d5383971..0dd9b289 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -609,10 +609,8 @@ handle_dhcp_packet(void *arg) } /* We should ensure that the packet is terminated correctly * if we have space for the terminator */ - if ((size_t)bytes < sizeof(struct dhcp_message)) { - p = (uint8_t *)dhcp + bytes - 1; - while (p > dhcp->options && *p == DHO_PAD) - p--; + if ((size_t)bytes != sizeof(*dhcp)) { + p = (uint8_t *)dhcp + (bytes - 1); if (*p != DHO_END) *++p = DHO_END; }