1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 07:51:19 +01:00

sys/net/dhcpv6: consider option 0 an end marker

The REPLY of a TP-Link router (WR400 v4.20) ends with a 0 option
that has a bogus length.
When subtracting the length from the remaining length, we get an
underflow (remaining `len` is 3, option len is 4).

To get a working DHCP response, consider 0 (Reserved) an end marker.
This commit is contained in:
Benjamin Valentin 2022-03-02 16:28:59 +01:00
parent 922a1d7c9a
commit 37a4fffb17

View File

@ -1016,6 +1016,10 @@ static bool _parse_reply(uint8_t *rep, size_t len, uint8_t request_type)
default:
break;
}
/* 0 option is used as an end marker, len can include bogus bytes */
if (!byteorder_ntohs(opt->type)) {
break;
}
}
if ((cid == NULL) || (sid == NULL)) {
DEBUG("DHCPv6 client: ADVERTISE does not contain either server ID "