]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Just terminate the DHCP message if not terminated. DHO_PAD could be valid data.
authorRoy Marples <roy@marples.name>
Thu, 29 Jan 2009 13:56:23 +0000 (13:56 +0000)
committerRoy Marples <roy@marples.name>
Thu, 29 Jan 2009 13:56:23 +0000 (13:56 +0000)
dhcpcd.c

index d5383971fa25434c76faff751b0ec52049aead4e..0dd9b289f2c7323b3202bfd57761998b8a1976fc 100644 (file)
--- 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;
                }