aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-03-16 11:42:56 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-03-16 11:42:56 +0100
commitfe78d70ec6c48f88126f6deffe04d4707a65c9ac (patch)
treec19b4ea47dad8bb445b25334d9b9b3e6adeffeb4
parent1c461df70ab357dc9e1e064540731c58e7859a45 (diff)
downloadbusybox-w32-fe78d70ec6c48f88126f6deffe04d4707a65c9ac.tar.gz
busybox-w32-fe78d70ec6c48f88126f6deffe04d4707a65c9ac.tar.bz2
busybox-w32-fe78d70ec6c48f88126f6deffe04d4707a65c9ac.zip
udhcpc: ignore zero-length DHCP options, take 2
advance the optionptr by two bytes, not one Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 99ecb7aa6..f2d6907ad 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -282,11 +282,11 @@ uint8_t* FAST_FUNC udhcp_scan_options(struct dhcp_packet *packet, struct dhcp_sc
282 * (this violates RFC 2132 section 3.14). 282 * (this violates RFC 2132 section 3.14).
283 */ 283 */
284 if (len == 0) { 284 if (len == 0) {
285 scan_state->rem -= OPT_LEN; 285 scan_state->rem -= 2;
286 scan_state->optionptr += OPT_LEN; 286 scan_state->optionptr += 2;
287 continue; 287 continue;
288 } 288 }
289 len += OPT_LEN; 289 len += 2;
290 scan_state->rem -= len; 290 scan_state->rem -= len;
291 if (scan_state->rem < 0) /* option is longer than options field? */ 291 if (scan_state->rem < 0) /* option is longer than options field? */
292 goto complain; /* yes, complain and return NULL */ 292 goto complain; /* yes, complain and return NULL */