[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r9219 - in /fsf/trunk/libc: ChangeLog resolv/mapv4v6hostent.h resolv/nss_dns/dns-host.c string/bits/string3.h



Author: eglibc
Date: Tue Nov 10 17:21:28 2009
New Revision: 9219

Log:
Import glibc-mainline for 2009-11-10

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/resolv/mapv4v6hostent.h
    fsf/trunk/libc/resolv/nss_dns/dns-host.c
    fsf/trunk/libc/string/bits/string3.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Nov 10 17:21:28 2009
@@ -1,3 +1,16 @@
+2009-11-10  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
+
+	* string/bits/string3.h (memset): If the second parameter is constant
+	and zero there is likely no transposition.
+	Patch by Caolan McNamara <caolanm@xxxxxxxxxxx
+
 2009-11-04  Philippe De Muyter  <phdm@xxxxxxxxx>
 
 	* sysdeps/powerpc/fpu/e_sqrt.c: Fix spelling of (Newton-)Raphson.

Modified: fsf/trunk/libc/resolv/mapv4v6hostent.h
==============================================================================
--- fsf/trunk/libc/resolv/mapv4v6hostent.h (original)
+++ fsf/trunk/libc/resolv/mapv4v6hostent.h Tue Nov 10 17:21:28 2009
@@ -57,13 +57,13 @@
     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 @@
       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 @@
       *bpp += IN6ADDRSZ;
       *lenp -= IN6ADDRSZ;
     }
+  return 0;
 }

Modified: fsf/trunk/libc/resolv/nss_dns/dns-host.c
==============================================================================
--- fsf/trunk/libc/resolv/nss_dns/dns-host.c (original)
+++ fsf/trunk/libc/resolv/nss_dns/dns-host.c Tue Nov 10 17:21:28 2009
@@ -878,7 +878,8 @@
 		}
 	      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 @@
 	}
 
       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;
     }

Modified: fsf/trunk/libc/string/bits/string3.h
==============================================================================
--- fsf/trunk/libc/string/bits/string3.h (original)
+++ fsf/trunk/libc/string/bits/string3.h Tue Nov 10 17:21:28 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2007, 2009 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
@@ -77,7 +77,8 @@
 __extern_always_inline void *
 __NTH (memset (void *__dest, int __ch, size_t __len))
 {
-  if (__builtin_constant_p (__len) && __len == 0)
+  if (__builtin_constant_p (__len) && __len == 0
+      && (!__builtin_constant_p (__ch) || __ch != 0))
     {
       __warn_memset_zero_len ();
       return __dest;