diff toys/pending/dhcp.c @ 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 e11684e3bbc5
children 85f297591693
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;