From c1dcc259ec192d7d3fa19cc85610ede80aab5c1f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 22 Jul 2020 05:03:47 +0200 Subject: [PATCH] systemd: dhcp6: remove assertions in dhcp6_option_parse_domainname() Assertions are for programming errors; here the input comes directly from the DHCP response packet. https://github.com/systemd/systemd/commit/af710b535b4ceacd0aecec6748a4f8ee57742e99 (cherry picked from commit e2248143af0d4ec61e571c4f358d5d7f1044289c) (cherry picked from commit 555c7e4ee627257127f61d1a2801174b9995b3ed) --- src/systemd/src/libsystemd-network/dhcp6-option.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/systemd/src/libsystemd-network/dhcp6-option.c b/src/systemd/src/libsystemd-network/dhcp6-option.c index bb4c4d9130..72cd9a4c80 100644 --- a/src/systemd/src/libsystemd-network/dhcp6-option.c +++ b/src/systemd/src/libsystemd-network/dhcp6-option.c @@ -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;