about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2014-05-07 11:47:20 +0200
committerAndreas Schwab <schwab@suse.de>2014-05-07 14:21:27 +0200
commit8dc9751764eb1bedf06d19695524b31a16773413 (patch)
tree27d244d23ae708f0c299033d84fb2cde101d6024 /sysdeps/posix
parenta11892631d92f594c690d0d50a642b0d1aba58b8 (diff)
downloadglibc-8dc9751764eb1bedf06d19695524b31a16773413.tar.gz
glibc-8dc9751764eb1bedf06d19695524b31a16773413.tar.xz
glibc-8dc9751764eb1bedf06d19695524b31a16773413.zip
Fix parsing of getai result from nscd for IPv6-only request
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 3385bed333..6258330759 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -710,16 +710,20 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  struct gaih_addrtuple *addrfree = addrmem;
 		  for (int i = 0; i < air->naddrs; ++i)
 		    {
+		      socklen_t size = (air->family[i] == AF_INET
+					? INADDRSZ : IN6ADDRSZ);
+
 		      if (!((air->family[i] == AF_INET
 			     && req->ai_family == AF_INET6
 			     && (req->ai_flags & AI_V4MAPPED) != 0)
 			    || req->ai_family == AF_UNSPEC
 			    || air->family[i] == req->ai_family))
-			/* Skip over non-matching result.  */
-			continue;
+			{
+			  /* Skip over non-matching result.  */
+			  addrs += size;
+			  continue;
+			}
 
-		      socklen_t size = (air->family[i] == AF_INET
-					? INADDRSZ : IN6ADDRSZ);
 		      if (*pat == NULL)
 			{
 			  *pat = addrfree++;