aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/dhcp.c
diff options
context:
space:
mode:
authorAshwini Sharma <ak.ashwini1981@gmail.com>2014-05-21 05:12:38 -0500
committerAshwini Sharma <ak.ashwini1981@gmail.com>2014-05-21 05:12:38 -0500
commit95d2ce84789011970e2f814b2fb6c819084bde8c (patch)
tree476a885945d14f5e0b59dbb7dc4974f93547a54d /toys/pending/dhcp.c
parentb06b0fe32361f7fc5b3fb98bf5f2c2791be757e8 (diff)
downloadtoybox-95d2ce84789011970e2f814b2fb6c819084bde8c.tar.gz
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.
Diffstat (limited to 'toys/pending/dhcp.c')
-rw-r--r--toys/pending/dhcp.c5
1 files changed, 4 insertions, 1 deletions
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;