]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp6: remove assertions in dhcp6_option_parse_domainname()
authorBeniamino Galvani <bgalvani@redhat.com>
Wed, 22 Jul 2020 03:03:47 +0000 (05:03 +0200)
committerBeniamino Galvani <bgalvani@redhat.com>
Tue, 28 Jul 2020 07:09:28 +0000 (09:09 +0200)
Assertions are for programming errors; here the input comes directly
from the DHCP response packet.

src/libsystemd-network/dhcp6-option.c

index fa43587686b224d6a41ffda415380ed7fa377892..f0a586bca4bf7cc7e32f23d56e2f867619cfc4d2 100644 (file)
@@ -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;