(svn r19385) -Fix [FS#3684]: [IPv6] Netmask calculations were wrong if cidr >= 32.

This commit is contained in:
rubidium 2010-03-11 17:57:14 +00:00
parent f7eb527a37
commit 6b35de215c

View File

@ -161,7 +161,7 @@ bool NetworkAddress::IsInNetmask(char *netmask)
while (cidr > 0) { while (cidr > 0) {
uint32 msk = cidr >= 32 ? (uint32)-1 : htonl(-(1 << (32 - cidr))); uint32 msk = cidr >= 32 ? (uint32)-1 : htonl(-(1 << (32 - cidr)));
if ((*mask & msk) != (*ip & msk)) return false; if ((*mask++ & msk) != (*ip++ & msk)) return false;
cidr -= 32; cidr -= 32;
} }