changeset 1294:88abd5b68a17 draft

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.
author Ashwini Sharma <ak.ashwini1981@gmail.com>
date Wed, 21 May 2014 05:12:38 -0500
parents 5f59ec6e38ff
children 114ec0ab161c
files toys/pending/dhcp.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/toys/pending/dhcp.c	Tue May 20 21:19:17 2014 -0500
+++ b/toys/pending/dhcp.c	Wed May 21 05:12:38 2014 -0500
@@ -1101,7 +1101,10 @@
   }
 
   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;