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>
This commit is contained in:
parent
1c461df70a
commit
fe78d70ec6
@ -282,11 +282,11 @@ uint8_t* FAST_FUNC udhcp_scan_options(struct dhcp_packet *packet, struct dhcp_sc
|
|||||||
* (this violates RFC 2132 section 3.14).
|
* (this violates RFC 2132 section 3.14).
|
||||||
*/
|
*/
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
scan_state->rem -= OPT_LEN;
|
scan_state->rem -= 2;
|
||||||
scan_state->optionptr += OPT_LEN;
|
scan_state->optionptr += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
len += OPT_LEN;
|
len += 2;
|
||||||
scan_state->rem -= len;
|
scan_state->rem -= len;
|
||||||
if (scan_state->rem < 0) /* option is longer than options field? */
|
if (scan_state->rem < 0) /* option is longer than options field? */
|
||||||
goto complain; /* yes, complain and return NULL */
|
goto complain; /* yes, complain and return NULL */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user