Mercurial > hg > toybox
comparison 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 |
comparison
equal
deleted
inserted
replaced
1293:5f59ec6e38ff | 1294:88abd5b68a17 |
---|---|
1099 msgopt_list[count].val = NULL; | 1099 msgopt_list[count].val = NULL; |
1100 } | 1100 } |
1101 } | 1101 } |
1102 | 1102 |
1103 while (*optptr != DHCP_OPTION_END) { | 1103 while (*optptr != DHCP_OPTION_END) { |
1104 while (*optptr == DHCP_OPTION_PADDING) optptr++; | 1104 if (*optptr == DHCP_OPTION_PADDING) { |
1105 optptr++; | |
1106 continue; | |
1107 } | |
1105 if (*optptr == DHCP_OPTION_OVERLOAD) { | 1108 if (*optptr == DHCP_OPTION_OVERLOAD) { |
1106 overloaded = optptr[2]; | 1109 overloaded = optptr[2]; |
1107 optptr += optptr[1] + 2; | 1110 optptr += optptr[1] + 2; |
1108 continue; | 1111 continue; |
1109 } | 1112 } |