dhcp6: fix buffer size checking

(cherry picked from commit cb1bdeaf56852275e6b0dd1fba932bb174767f70)
(cherry picked from commit 91fb1673d5)
This commit is contained in:
Yu Watanabe 2018-09-27 23:48:51 +09:00 committed by Thomas Haller
parent 3fd9d11619
commit 15a3c6c692

View file

@ -776,8 +776,8 @@ static int client_parse_message(
uint8_t *optval;
be32_t iaid_lease;
if (len < offsetof(DHCP6Option, data) ||
len < offsetof(DHCP6Option, data) + be16toh(option->len))
if (len < pos + offsetof(DHCP6Option, data) ||
len < pos + offsetof(DHCP6Option, data) + be16toh(option->len))
return -ENOBUFS;
optcode = be16toh(option->code);