This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, master, updated. glibc-2.11-11-g51e4196
- From: drepper at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 10 Nov 2009 15:41:04 -0000
- Subject: GNU C Library master sources branch, master, updated. glibc-2.11-11-g51e4196
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 51e4196f16a2d98377e3c481a44e133369dc7669 (commit)
from 6515a01fc1d35d329886d5a45435537ee9115bc4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=51e4196f16a2d98377e3c481a44e133369dc7669
commit 51e4196f16a2d98377e3c481a44e133369dc7669
Author: Andreas Schwab <schwab@redhat.com>
Date: Tue Nov 10 07:36:50 2009 -0800
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.
diff --git a/ChangeLog b/ChangeLog
index ac8baf1..49c2e08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,15 @@
+2009-11-10 Andreas Schwab <schwab@redhat.com>
+
+ * resolv/mapv4v6hostent.h (map_v4v6_hostent): Return non-zero if
+ out of buffer space.
+ * resolv/nss_dns/dns-host.c (getanswer_r): Check for
+ map_v4v6_hostent running out of space.
+
2009-11-10 Ulrich Drepper <drepper@redhat.com>
* string/bits/string3.h (memset): If the second parameter is constant
and zero there is likely no transposition.
+ Patch by Caolan McNamara <caolanm@redhat.com.
2009-11-04 Philippe De Muyter <phdm@macqel.be>
diff --git a/resolv/mapv4v6hostent.h b/resolv/mapv4v6hostent.h
index 4151ce3..c11038a 100644
--- a/resolv/mapv4v6hostent.h
+++ b/resolv/mapv4v6hostent.h
@@ -57,13 +57,13 @@ typedef union {
char ac;
} align;
-static void
+static int
map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
{
char **ap;
if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
- return;
+ return 0;
hp->h_addrtype = AF_INET6;
hp->h_length = IN6ADDRSZ;
for (ap = hp->h_addr_list; *ap; ap++)
@@ -71,11 +71,8 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
int i = sizeof (align) - ((u_long) *bpp % sizeof (align));
if (*lenp < (i + IN6ADDRSZ))
- {
- /* Out of memory. Truncate address list here. XXX */
- *ap = NULL;
- return;
- }
+ /* Out of memory. */
+ return 1;
*bpp += i;
*lenp -= i;
map_v4v6_address (*ap, *bpp);
@@ -83,4 +80,5 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
*bpp += IN6ADDRSZ;
*lenp -= IN6ADDRSZ;
}
+ return 0;
}
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;
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 ++++++++
resolv/mapv4v6hostent.h | 12 +++++-------
resolv/nss_dns/dns-host.c | 6 ++++--
3 files changed, 17 insertions(+), 9 deletions(-)
hooks/post-receive
--
GNU C Library master sources