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.16-ports-merge-34-g7b6e99b
- From: siddhesh at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 12 Jul 2012 06:04:07 -0000
- Subject: GNU C Library master sources branch, master, updated. glibc-2.16-ports-merge-34-g7b6e99b
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 7b6e99be77c24a79cb07416d81796b45176923c6 (commit)
from a766fb45a3473c416df010d614287012f7a00838 (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=7b6e99be77c24a79cb07416d81796b45176923c6
commit 7b6e99be77c24a79cb07416d81796b45176923c6
Author: Jeroen van Bemmel <jvb127@gmail.com>
Date: Thu Jul 12 11:23:28 2012 +0530
Avoid duplicate DNS requests if answer is longer than a implementation
limit
[BZ #14307]
* sysdeps/posix/getaddrinfo.c (gaih_inet): Increase the size of
the temporary buffer used to invoke __gethostbyname2_r,
__gethostbyaddr_r and gethostbyname4_r to make room for struct
host_data / struct gaih_addrtuple.
* resolv/nss_dns/dns-host.c (global scope): Move definition of
implementation constants MAX_NR_ALIASES and MAX_NR_ADDRS to
header file nss/nsswitch.h.
* nss/nsswitch.h (global scope): Add definition of implementation
constants MAX_NR_ALIASES and MAX_NR_ADDRS (moved from
resolv/nss_dns/dns-host.c).
diff --git a/ChangeLog b/ChangeLog
index bcda549..db8e187 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-07-12 Jeroen van Bemmel <jvb127@gmail.com>
+
+ [BZ #14307]
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Increase the size of
+ the temporary buffer used to invoke __gethostbyname2_r,
+ __gethostbyaddr_r and gethostbyname4_r to make room for struct
+ host_data / struct gaih_addrtuple.
+ * resolv/nss_dns/dns-host.c (global scope): Move definition of
+ implementation constants MAX_NR_ALIASES and MAX_NR_ADDRS to
+ header file nss/nsswitch.h.
+ * nss/nsswitch.h (global scope): Add definition of implementation
+ constants MAX_NR_ALIASES and MAX_NR_ADDRS (moved from
+ resolv/nss_dns/dns-host.c).
+
2012-07-11 Andreas Jaeger <aj@suse.de>
* po/fr.po: Update from translation team.
diff --git a/nss/nsswitch.h b/nss/nsswitch.h
index 90e208b..047a9e5 100644
--- a/nss/nsswitch.h
+++ b/nss/nsswitch.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1996-1999,2001,2002,2003,2004,2007,2010,2011
- Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -198,4 +197,8 @@ extern int __nss_hostname_digits_dots (const char *name,
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 --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index a924d40..6b62c05 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -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 --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 2eca2ae..78a2474 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -568,7 +568,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
IPv6 scope ids. */
if (req->ai_family == AF_INET)
{
- size_t tmpbuflen = 512;
+ /* Allocate additional room for struct host_data. */
+ size_t tmpbuflen = (512 + MAX_NR_ALIASES * sizeof(char*)
+ + 16 * sizeof(char));
assert (tmpbuf == NULL);
tmpbuf = alloca_account (tmpbuflen, alloca_used);
int rc;
@@ -811,7 +813,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
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)
@@ -1113,7 +1115,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
struct hostent *h = NULL;
int herrno;
struct hostent th;
- size_t tmpbuf2len = 512;
+ /* Add room for struct host_data. */
+ size_t tmpbuf2len = (512 + (MAX_NR_ALIASES+MAX_NR_ADDRS+1)
+ * sizeof(char*) + 16 * sizeof(char));
do
{
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 14 ++++++++++++++
nss/nsswitch.h | 7 +++++--
resolv/nss_dns/dns-host.c | 4 ----
sysdeps/posix/getaddrinfo.c | 10 +++++++---
4 files changed, 26 insertions(+), 9 deletions(-)
hooks/post-receive
--
GNU C Library master sources