From d6b90bace0ba2ca906764dde70213ed3c47f8edd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 26 Apr 2013 09:51:32 +0300 Subject: gdhcp: The last option in a message was not parsed correctly If the desired option was last one in the message, then it was lost because the remaining data calculation was wrong. --- gdhcp/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdhcp/common.c') diff --git a/gdhcp/common.c b/gdhcp/common.c index e8676f88..0c433ddc 100644 --- a/gdhcp/common.c +++ b/gdhcp/common.c @@ -172,8 +172,8 @@ uint8_t *dhcpv6_get_option(struct dhcpv6_packet *packet, uint16_t pkt_len, if (opt_code == code) { if (option_len != NULL) *option_len = opt_len; - if (rem == 0) - found = NULL; + if (rem < 0) + goto bad_packet; else found = optionptr + 2 + 2; count++; -- cgit v1.2.3