From: Beniamino Galvani Date: Wed, 22 Jul 2020 03:03:47 +0000 (+0200) Subject: dhcp6: remove assertions in dhcp6_option_parse_domainname() X-Git-Tag: v247-rc1~463^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af710b535b4ceacd0aecec6748a4f8ee57742e99;p=thirdparty%2Fsystemd.git dhcp6: remove assertions in dhcp6_option_parse_domainname() Assertions are for programming errors; here the input comes directly from the DHCP response packet. --- diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index fa43587686b..f0a586bca4b 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -647,8 +647,10 @@ int dhcp6_option_parse_domainname(const uint8_t *optval, uint16_t optlen, char * _cleanup_strv_free_ char **names = NULL; int r; - assert_return(optlen > 1, -ENODATA); - assert_return(optval[optlen - 1] == '\0', -EINVAL); + if (optlen <= 1) + return -ENODATA; + if (optval[optlen - 1] != '\0') + return -EINVAL; while (pos < optlen) { _cleanup_free_ char *ret = NULL;