From: Yu Watanabe Date: Sun, 13 Oct 2024 06:08:04 +0000 (+0900) Subject: network/address: do not set family in config_parse_broadcast() X-Git-Tag: v257-rc1~236^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f639b25554658d8f1021ab6ea8724f8078ccc28;p=thirdparty%2Fsystemd.git network/address: do not set family in config_parse_broadcast() The family will be checked later in address_section_verify() -> address_section_adjust_broadcast(), hence it is not necessary to set here. Follow-up for 5d15c7b19cae6d3332d4e213c380e0fcc1317a2c. Fixes oss-fuzz#372994449. Fixes #34748. --- diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index deffa4deade..228cb93fc82 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -2033,9 +2033,12 @@ static int config_parse_broadcast( union in_addr_union u; int r; + /* Do not check or set address->family here. It will be checked later in + * address_section_verify() -> address_section_adjust_broadcast() . */ + if (isempty(rvalue)) { /* The broadcast address will be calculated based on Address=, and set if the link is - * not a wireguard interface. Here, we do not check or set address->family. */ + * not a wireguard interface. */ address->broadcast = (struct in_addr) {}; address->set_broadcast = -1; return 1; @@ -2043,8 +2046,7 @@ static int config_parse_broadcast( r = parse_boolean(rvalue); if (r >= 0) { - /* The broadcast address will be calculated based on Address=. Here, we do not check or - * set address->family. */ + /* The broadcast address will be calculated based on Address=. */ address->broadcast = (struct in_addr) {}; address->set_broadcast = r; return 1; @@ -2061,7 +2063,6 @@ static int config_parse_broadcast( address->broadcast = u.in; address->set_broadcast = true; - address->family = AF_INET; return 1; } diff --git a/test/fuzz/fuzz-network-parser/oss-fuzz-372994449 b/test/fuzz/fuzz-network-parser/oss-fuzz-372994449 new file mode 100644 index 00000000000..76c3a4903cb Binary files /dev/null and b/test/fuzz/fuzz-network-parser/oss-fuzz-372994449 differ