From 95d2ce84789011970e2f814b2fb6c819084bde8c Mon Sep 17 00:00:00 2001 From: Ashwini Sharma Date: Wed, 21 May 2014 05:12:38 -0500 Subject: dhcp client had a segfault, when DHCP message contained 'pad' option. The parsing logic kept checking for other options beyond __pad__ option, without checking if it was __end__ option after that or not. --- toys/pending/dhcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toys/pending/dhcp.c') diff --git a/toys/pending/dhcp.c b/toys/pending/dhcp.c index f93c9406..2b432cb3 100644 --- a/toys/pending/dhcp.c +++ b/toys/pending/dhcp.c @@ -1101,7 +1101,10 @@ static uint8_t dhcpc_parseoptions(dhcpc_result_t *presult, uint8_t *optptr) } while (*optptr != DHCP_OPTION_END) { - while (*optptr == DHCP_OPTION_PADDING) optptr++; + if (*optptr == DHCP_OPTION_PADDING) { + optptr++; + continue; + } if (*optptr == DHCP_OPTION_OVERLOAD) { overloaded = optptr[2]; optptr += optptr[1] + 2; -- cgit v1.2.3