aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/common.c')
-rw-r--r--networking/udhcp/common.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index ae818db05..ad580f38d 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -252,6 +252,14 @@ uint8_t* FAST_FUNC udhcp_scan_options(struct dhcp_packet *packet, struct dhcp_sc
252 /* option bytes: [code][len][data1][data2]..[dataLEN] */ 252 /* option bytes: [code][len][data1][data2]..[dataLEN] */
253 while (1) { 253 while (1) {
254 if (scan_state->rem <= 0) { 254 if (scan_state->rem <= 0) {
255 if (ENABLE_FEATURE_UDHCPD_BOOTP && scan_state->rem == 0) {
256 /* DHCP requires END option to be present.
257 * We are here if packet fails this condition
258 * (options[] are zero-padded to the end).
259 * Assume BOOTP packet without further checks.
260 */
261 break; /* return NULL */
262 }
255 complain: 263 complain:
256 bb_simple_error_msg("bad packet, malformed option field"); 264 bb_simple_error_msg("bad packet, malformed option field");
257 return NULL; 265 return NULL;
@@ -278,7 +286,7 @@ uint8_t* FAST_FUNC udhcp_scan_options(struct dhcp_packet *packet, struct dhcp_sc
278 scan_state->rem = sizeof(packet->sname); 286 scan_state->rem = sizeof(packet->sname);
279 continue; 287 continue;
280 } 288 }
281 break; 289 break; /* return NULL */
282 } 290 }
283 291
284 if (scan_state->rem <= OPT_LEN) /* [len] byte exists? */ 292 if (scan_state->rem <= OPT_LEN) /* [len] byte exists? */