systemd: dhcp6: remove assertions in dhcp6_option_parse_domainname()

Assertions are for programming errors; here the input comes directly
from the DHCP response packet.

af710b535b
(cherry picked from commit e2248143af)
(cherry picked from commit 555c7e4ee6)
This commit is contained in:
Beniamino Galvani 2020-07-22 05:03:47 +02:00 committed by Antonio Cardace
parent d32148fd66
commit c1dcc259ec
No known key found for this signature in database
GPG key ID: 6BF80ABD43E377D3

View file

@ -539,8 +539,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;