arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh1324568.patch

147e83
Upstream commits:
147e83
147e83
commit a071766ebfd853179ac39f9773f894029bf86d36
147e83
Author: Andreas Schwab <schwab@suse.de>
147e83
Date:   Thu Mar 20 15:05:25 2014 +0100
147e83
147e83
    Fix use of half-initialized result in getaddrinfo when using nscd (bug 16743)
147e83
    
147e83
    This fixes a bug in the way the results from __nscd_getai are collected:
147e83
    for every returned result a new entry is first added to the
147e83
    gaih_addrtuple list, but if that result doesn't match the request this
147e83
    entry remains uninitialized.  So for this non-matching result an extra
147e83
    result with uninitialized content is returned.
147e83
    
147e83
    To reproduce (with nscd running):
147e83
    
147e83
        $ getent ahostsv4 localhost
147e83
        127.0.0.1       STREAM localhost
147e83
        127.0.0.1       DGRAM
147e83
        127.0.0.1       RAW
147e83
        (null)          STREAM
147e83
        (null)          DGRAM
147e83
        (null)          RAW
147e83
147e83
commit 8dc9751764eb1bedf06d19695524b31a16773413
147e83
Author: Andreas Schwab <schwab@suse.de>
147e83
Date:   Wed May 7 11:47:20 2014 +0200
147e83
147e83
    Fix parsing of getai result from nscd for IPv6-only request
147e83
147e83
147e83
Index: b/sysdeps/posix/getaddrinfo.c
147e83
===================================================================
147e83
--- a/sysdeps/posix/getaddrinfo.c
147e83
+++ b/sysdeps/posix/getaddrinfo.c
147e83
@@ -725,6 +725,18 @@ gaih_inet (const char *name, const struc
147e83
 		    {
147e83
 		      socklen_t size = (air->family[i] == AF_INET
147e83
 					? INADDRSZ : IN6ADDRSZ);
147e83
+
147e83
+		      if (!((air->family[i] == AF_INET
147e83
+			     && req->ai_family == AF_INET6
147e83
+			     && (req->ai_flags & AI_V4MAPPED) != 0)
147e83
+			    || req->ai_family == AF_UNSPEC
147e83
+			    || air->family[i] == req->ai_family))
147e83
+			{
147e83
+			  /* Skip over non-matching result.  */
147e83
+			  addrs += size;
147e83
+			  continue;
147e83
+			}
147e83
+
147e83
 		      if (*pat == NULL)
147e83
 			{
147e83
 			  *pat = addrfree++;