aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-19 03:44:56 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-10-19 06:11:58 +0900
commit91c43f3978fa7c8341550b9ca279e460ba7e74e6 (patch)
tree0b98687a06ee8e390995926c97e0622d731c4004 /src/libsystemd-network/sd-dhcp6-client.c
parentMerge pull request #10456 from poettering/setsockopt-int (diff)
downloadsystemd-91c43f3978fa7c8341550b9ca279e460ba7e74e6.tar.gz
systemd-91c43f3978fa7c8341550b9ca279e460ba7e74e6.tar.bz2
systemd-91c43f3978fa7c8341550b9ca279e460ba7e74e6.zip
sd-dhcp6: fix argument and error handling of dhcp6_option_parse_status()
Diffstat (limited to 'src/libsystemd-network/sd-dhcp6-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index c07d831f7..723e349a5 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -900,13 +900,14 @@ static int client_parse_message(
break;
case SD_DHCP6_OPTION_STATUS_CODE:
- status = dhcp6_option_parse_status(option, optlen);
- if (status) {
+ status = dhcp6_option_parse_status(option, optlen + sizeof(DHCP6Option));
+ if (status < 0)
+ return status;
+
+ if (status > 0) {
log_dhcp6_client(client, "%s Status %s",
dhcp6_message_type_to_string(message->type),
dhcp6_message_status_to_string(status));
- dhcp6_lease_free_ia(&lease->ia);
- dhcp6_lease_free_ia(&lease->pd);
return -EINVAL;
}