You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside NetworkAddress::IsInNetmask, when comparing bits of two addresses in 32-bit portions, pointers are not being advanced to next portion of bits thus only 32-bit address is compared properly. ++ operator is missing:
There is (network\core\address.cpp:164):
if ((*mask & msk) != (*ip & msk)) return false;
And should be:
if ((*mask++ & msk) != (*ip++ & msk)) return false;
Fix-patch attached.
By the way, few lines up (line 123), there is default mask length calculated as fallows:
int cidr = this->address.ss_family == AF_INET ? 32 : 128;
I think it would be nicer to take the length of address:
int cidr = this->address.address_length;
If only the address_length was the actual length of the address in any sensible way; it's the sizeof of sockaddr_in/sockaddr_in6 which on my system are respectively 16 and 28.
adf88 opened the ticket and wrote:
Attachments
Reported version: Version?
Operating system: All
This issue was imported from FlySpray: https://bugs.openttd.org/task/3684
The text was updated successfully, but these errors were encountered: