diff -Nrup a/nss/nsswitch.h b/nss/nsswitch.h --- a/nss/nsswitch.h 2012-06-30 13:12:34.000000000 -0600 +++ b/nss/nsswitch.h 2012-10-16 12:43:09.377834729 -0600 @@ -198,4 +198,8 @@ extern int __nss_hostname_digits_dots (c int *h_errnop); libc_hidden_proto (__nss_hostname_digits_dots) +/* Maximum number of aliases we allow. */ +#define MAX_NR_ALIASES 48 +#define MAX_NR_ADDRS 48 + #endif /* nsswitch.h */ diff -Nrup a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c --- a/resolv/nss_dns/dns-host.c 2012-06-30 13:12:34.000000000 -0600 +++ b/resolv/nss_dns/dns-host.c 2012-10-16 12:43:09.379834766 -0600 @@ -88,10 +88,6 @@ #define RESOLVSORT -/* Maximum number of aliases we allow. */ -#define MAX_NR_ALIASES 48 -#define MAX_NR_ADDRS 48 - #if PACKETSZ > 65536 # define MAXPACKET PACKETSZ #else diff -Nrup a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c --- a/sysdeps/posix/getaddrinfo.c 2012-10-16 12:42:34.398174840 -0600 +++ b/sysdeps/posix/getaddrinfo.c 2012-10-16 12:43:09.381834802 -0600 @@ -568,7 +568,10 @@ gaih_inet (const char *name, const struc IPv6 scope ids, nor retrieving the canonical name. */ if (req->ai_family == AF_INET && (req->ai_flags & AI_CANONNAME) == 0) { - size_t tmpbuflen = 512; + /* Add room for struct host_data in resolv/nss_dns/dns-host.c */ + size_t tmpbuflen = 512 + (MAX_NR_ALIASES+MAX_NR_ADDRS+1)*sizeof(char*) + + 16 * sizeof(char); + assert (tmpbuf == NULL); tmpbuf = alloca_account (tmpbuflen, alloca_used); int rc; @@ -811,7 +814,7 @@ gaih_inet (const char *name, const struc old_res_options = _res.options; _res.options &= ~RES_USE_INET6; - size_t tmpbuflen = 1024; + size_t tmpbuflen = 1024 + sizeof(struct gaih_addrtuple); malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen); assert (tmpbuf == NULL); if (!malloc_tmpbuf)