]> 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:12 +0000 (13:56 +0000)
committerRoy Marples <roy@marples.name>
Thu, 29 Jan 2009 13:56:12 +0000 (13:56 +0000)
client.c

index 3fd0aecd6f65fcfe52bc03ec78542d96a7d0ca51..757f236a49299ee8c5ffde5e6439118ee6f6ed1b 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1581,10 +1581,8 @@ handle_dhcp_packet(struct if_state *state, const struct options *options)
                }
                /* 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;
                }