summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dhcpv4.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index 2b30307..b803359 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -493,7 +493,9 @@ static void dhcpv4_put(struct dhcpv4_message *msg, uint8_t **cookie,
uint8_t type, uint8_t len, const void *data)
{
uint8_t *c = *cookie;
- if (*cookie + 2 + len > (uint8_t*)&msg[1])
+ uint8_t *end = (uint8_t *)msg + sizeof(*msg);
+
+ if (*cookie + 2 + len > end)
return;
*c++ = type;