aboutsummaryrefslogtreecommitdiff
path: root/resolv/nss_dns
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-11-10 07:36:50 -0800
committerUlrich Drepper <drepper@redhat.com>2009-11-10 07:36:50 -0800
commit51e4196f16a2d98377e3c481a44e133369dc7669 (patch)
treee2d83a34e0bbe6f47dfe733f6062b6508e4d6868 /resolv/nss_dns
parent6515a01fc1d35d329886d5a45435537ee9115bc4 (diff)
downloadglibc-51e4196f16a2d98377e3c481a44e133369dc7669.zip
glibc-51e4196f16a2d98377e3c481a44e133369dc7669.tar.gz
glibc-51e4196f16a2d98377e3c481a44e133369dc7669.tar.bz2
Handle running out of buffer space with IPv6 mapping enabled.
With big DNS answers like the one you get for goodtimesdot.com you can get a truncated address list if IPv6 mapping is enabled. Instead tell the caller to resize the buffer.
Diffstat (limited to 'resolv/nss_dns')
-rw-r--r--resolv/nss_dns/dns-host.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 62e67e8..818a40a 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -878,7 +878,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
}
bp += n;
linebuflen -= n;
- map_v4v6_hostent (result, &bp, &linebuflen);
+ if (map_v4v6_hostent (result, &bp, &linebuflen))
+ goto too_small;
}
*h_errnop = NETDB_SUCCESS;
return NSS_STATUS_SUCCESS;
@@ -953,7 +954,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
}
if (have_to_map)
- map_v4v6_hostent (result, &bp, &linebuflen);
+ if (map_v4v6_hostent (result, &bp, &linebuflen))
+ goto too_small;
*h_errnop = NETDB_SUCCESS;
return NSS_STATUS_SUCCESS;
}