sd-dhcp-lease: fix an infinite loop found by the fuzzer
authorEvgeny Vereshchagin <evvers@ya.ru>
Sat, 29 Jan 2022 02:08:39 +0000 (02:08 +0000)
committerLuca Boccassi <bluca@debian.org>
Tue, 15 Feb 2022 01:13:47 +0000 (01:13 +0000)
(cherry picked from commit 86b06c666be8b7afb45541d35aa4d0ecb38056d1)
(cherry picked from commit 426807c54b9500b806eaaf50d32c7c936510706c)

src/libsystemd-network/sd-dhcp-lease.c

index 9a0d7f6feaccab5b00c059954a98bced0d1e8163..75aa0c3d2c5944fec1e9e8daca34988b4373518c 100644 (file)
@@ -463,10 +463,8 @@ static int lease_parse_routes(
 
                 route->option = SD_DHCP_OPTION_STATIC_ROUTE;
                 r = in4_addr_default_prefixlen((struct in_addr*) option, &route->dst_prefixlen);
-                if (r < 0) {
-                        log_debug("Failed to determine destination prefix length from class based IP, ignoring");
-                        continue;
-                }
+                if (r < 0)
+                        return -EINVAL;
 
                 assert_se(lease_parse_be32(option, 4, &addr.s_addr) >= 0);
                 route->dst_addr = inet_makeaddr(inet_netof(addr), 0);