]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerEvgeny Vereshchagin <evvers@ya.ru>
Sat, 29 Jan 2022 02:17:39 +0000 (02:17 +0000)
src/libsystemd-network/sd-dhcp-lease.c

index ab131701fbc163e494323c10a425e793b0a68eec..bc6591a39b1cae194cf14e5d00251b630e43a3ff 100644 (file)
@@ -492,10 +492,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);