]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ProxyARP: Use more robust DHCP option parsing
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 31 Jan 2017 12:43:56 +0000 (14:43 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 31 Jan 2017 15:46:13 +0000 (17:46 +0200)
Do not depend on undefined behavior with pointer arithmetic when
checking whether there is sufficient room for an option.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/ap/dhcp_snoop.c

index 1b356a2b8802cea2993c821036ae64175937ce95..b9a36d760fd013340800f9c49ee0c3a029d8bb92 100644 (file)
@@ -62,6 +62,8 @@ static void handle_dhcp(void *ctx, const u8 *src_addr, const u8 *buf,
                if (*opt == DHCP_OPT_PAD)
                        continue;
 
+               if (pos >= end || 1 + *pos > end - pos)
+                       break;
                pos += *pos + 1;
                if (pos >= end)
                        break;