summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-09-27 16:48:51 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-09-27 16:48:51 +0200
commitcb1bdeaf56852275e6b0dd1fba932bb174767f70 (patch)
tree2024bcf202a9b4de612724bfefa843fcc9e9b1a8 /src/libsystemd-network
parentdhcp6: use offsetof instead of sizeof (diff)
downloadsystemd-cb1bdeaf56852275e6b0dd1fba932bb174767f70.tar.xz
systemd-cb1bdeaf56852275e6b0dd1fba932bb174767f70.zip
dhcp6: fix buffer size checking
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 6e7ccce6dc..78994364cb 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -844,8 +844,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);