1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-22 14:39:24 -05:00

sk_address_is_local() was ignoring the possibility that a SockAddr

might have an IPv4 address in `ai' rather than in `addresses'.
Thanks to Martin Prikryl for pointing this out.

[originally from svn r5587]
This commit is contained in:
Simon Tatham 2005-04-01 08:46:26 +00:00
parent 9e4d795787
commit 91b10030c8

View File

@ -572,10 +572,18 @@ int sk_address_is_local(SockAddr addr)
} else } else
#endif #endif
if (addr->family == AF_INET) { if (addr->family == AF_INET) {
struct in_addr a; #ifndef NO_IPV6
assert(addr->addresses && addr->curraddr < addr->naddresses); if (addr->ai) {
a.s_addr = p_htonl(addr->addresses[addr->curraddr]); return ipv4_is_local_addr(((struct sockaddr_in *)addr->ai->ai_addr)
return ipv4_is_local_addr(a); ->sin_addr);
} else
#endif
{
struct in_addr a;
assert(addr->addresses && addr->curraddr < addr->naddresses);
a.s_addr = p_htonl(addr->addresses[addr->curraddr]);
return ipv4_is_local_addr(a);
}
} else { } else {
assert(addr->family == AF_UNSPEC); assert(addr->family == AF_UNSPEC);
return 0; /* we don't know; assume not */ return 0; /* we don't know; assume not */