aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2022-01-29 02:08:39 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2022-01-29 02:17:39 +0000
commit86b06c666be8b7afb45541d35aa4d0ecb38056d1 (patch)
treeb96ba21d1ba775d0ff6ff2b26d6b9d42273c0e93
parenttests: fuzz client_handle_offer (diff)
downloadsystemd-86b06c666be8b7afb45541d35aa4d0ecb38056d1.tar.xz
systemd-86b06c666be8b7afb45541d35aa4d0ecb38056d1.zip
sd-dhcp-lease: fix an infinite loop found by the fuzzer
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index ab131701fbc..bc6591a39b1 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -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);