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 5d15c7b19c.

Fixes oss-fuzz#372994449.
Fixes #34748.
This commit is contained in:
Yu Watanabe 2024-10-13 15:08:04 +09:00
parent 709fdcc75a
commit 6f639b2555
2 changed files with 5 additions and 4 deletions

View File

@ -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;
}

Binary file not shown.