diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-10-01 21:42:39 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-10-01 21:42:39 +0000 |
commit | 20cc4c87c02444b5836052fac76a57895c3b5f87 (patch) | |
tree | c50375227c44e1977c46287e576928641d66f060 /resolv | |
parent | a7123f0edfea20a68e64e447dc6ca0c32736be0e (diff) | |
download | glibc-20cc4c87c02444b5836052fac76a57895c3b5f87.tar.gz glibc-20cc4c87c02444b5836052fac76a57895c3b5f87.tar.xz glibc-20cc4c87c02444b5836052fac76a57895c3b5f87.zip |
Update.
1999-10-01 Ulrich Drepper <drepper@cygnus.com> * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Align handling of IPv6 tunnel address handling with bind 8.2.1. Allow len argument to be greater than needed address size.
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/nss_dns/dns-host.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index c075961e91..482cbd3ab4 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -197,6 +197,7 @@ _nss_dns_gethostbyaddr_r (const char *addr, size_t len, int af, { static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff }; static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 }; + static const u_char v6local[] = { 0,0, 0,1 }; const u_char *uaddr = (const u_char *)addr; struct host_data { @@ -210,9 +211,10 @@ _nss_dns_gethostbyaddr_r (const char *addr, size_t len, int af, size_t size; int n, status; - if (af == AF_INET6 && len == IN6ADDRSZ && - (memcmp (uaddr, mapped, sizeof mapped) == 0 - || memcmp (uaddr, tunnelled, sizeof tunnelled) == 0)) + if (af == AF_INET6 && len == IN6ADDRSZ + && (memcmp (uaddr, mapped, sizeof mapped) == 0 + || (memcmp (uaddr, tunnelled, sizeof tunnelled) == 0 + && memcmp (&uaddr[sizeof tunnelled], v6local, sizeof v6local)))) { /* Unmap. */ addr += sizeof mapped; @@ -234,7 +236,7 @@ _nss_dns_gethostbyaddr_r (const char *addr, size_t len, int af, *h_errnop = NETDB_INTERNAL; return NSS_STATUS_UNAVAIL; } - if (size != len) + if (size > len) { *errnop = EAFNOSUPPORT; *h_errnop = NETDB_INTERNAL; |