mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Fix length->netmask conversions to avoid undefined behaviour.
This commit is contained in:
committed by
Simon Kelley
parent
15b1b7e9c3
commit
10cfc0ddb3
@@ -31,7 +31,7 @@ static struct addrlist *find_subnet(struct auth_zone *zone, int flag, struct all
|
||||
if (!(flag & F_IPV4))
|
||||
continue;
|
||||
|
||||
netmask.s_addr = htonl(~((1 << (32 - subnet->prefixlen)) - 1));
|
||||
netmask.s_addr = htonl(~(in_addr_t)0 << (32 - subnet->prefixlen));
|
||||
|
||||
if (is_same_net(addr, subnet->addr.addr.addr4, netmask))
|
||||
return subnet;
|
||||
|
||||
Reference in New Issue
Block a user