Closed
Description
The checkIp4 method in IpUtils is able to check whether an IP belongs to a particular subnet specified in CIDR notation, however it incorrectly states that all IP addresses are not members of the subnet 0.0.0.0/0.
This is due to the check on the size of the netmask in IpUtils::checkIp4
- if the netmask is less than -1
, then it immediately returns false
, which is incorrect - all IPv4 addresses are members of the /0 subnet by default.
This can easily be fixed by adding a check for whether $netmask === 0
, and if so, returning true
immediately, since all IPs would be a member.