upstream commit
https://sourceware.org/git/?p=glibc.git&a=commit&h=f8aeae347377f3dfa8cbadde057adf1827fb1d44
fixes this problem in a different way, so this patch is not needed upstream.
+
+resolv/nss_dns/dns-host.c
+ For b/21023324, backport buffer overflow in getanswer_r (PR18287, CVE-2015-1781)
+ https://sourceware.org/git/?p=glibc.git;a=commit;h=2959eda9272a03386
int have_to_map = 0;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
buffer += pad;
- if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0))
+ buflen = buflen > pad ? buflen - pad : 0;
+ if (__builtin_expect (buflen < sizeof (struct host_data), 0))
{
/* The buffer is too small. */
too_small: