mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00: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:
parent
9e4d795787
commit
91b10030c8
@ -572,10 +572,18 @@ int sk_address_is_local(SockAddr addr)
|
||||
} else
|
||||
#endif
|
||||
if (addr->family == AF_INET) {
|
||||
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);
|
||||
#ifndef NO_IPV6
|
||||
if (addr->ai) {
|
||||
return ipv4_is_local_addr(((struct sockaddr_in *)addr->ai->ai_addr)
|
||||
->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 {
|
||||
assert(addr->family == AF_UNSPEC);
|
||||
return 0; /* we don't know; assume not */
|
||||
|
Loading…
Reference in New Issue
Block a user