aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-07-13 08:06:26 +0100
committerRon Yorston <rmy@pobox.com>2023-07-13 08:06:26 +0100
commitbd978d0256fd3a67de1a7dd54f1a37f9435be363 (patch)
treecb869384a533ac0d95fe787d75be6c050e1e7c1a /networking/udhcp/common.c
parentb2901ce8efa050da00e0f3a73f3be9bf9402deea (diff)
parentd70256a5c719439cc6fab6a4571c1bb46178e4c7 (diff)
downloadbusybox-w32-bd978d0256fd3a67de1a7dd54f1a37f9435be363.tar.gz
busybox-w32-bd978d0256fd3a67de1a7dd54f1a37f9435be363.tar.bz2
busybox-w32-bd978d0256fd3a67de1a7dd54f1a37f9435be363.zip
Merge branch 'busybox' into merge
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? */