summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-01-29 13:56:12 +0000
committerRoy Marples <roy@marples.name>2009-01-29 13:56:12 +0000
commitc7c74f121b85ce297fe1e836058baa605141636c (patch)
treef1125c3e8aa425fea2a15fcccc76bf0af6047d87
parent2f0898a29aec284e0885e7b96a9f3f12908bdcfb (diff)
downloaddhcpcd-c7c74f121b85ce297fe1e836058baa605141636c.tar.xz
Just terminate the DHCP message if not terminated. DHO_PAD could be valid data.
-rw-r--r--client.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/client.c b/client.c
index 3fd0aecd..757f236a 100644
--- 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;
}