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

r3317 - in glibc-package/trunk/debian: . patches patches/any



Author: aurel32
Date: 2009-02-25 17:20:27 +0000 (Wed, 25 Feb 2009)
New Revision: 3317

Added:
   glibc-package/trunk/debian/patches/any/cvs-bz7058-nss_nss-nis.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
  * patches/any/cvs-bz7058-nss_nss-nis.diff: new patch to fix crash when
    doing host lookup with nss-nis.  Closes: bug#517094.



Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2009-02-25 16:42:39 UTC (rev 3316)
+++ glibc-package/trunk/debian/changelog	2009-02-25 17:20:27 UTC (rev 3317)
@@ -6,7 +6,7 @@
   * debian/debhelper.in/libc{-alt,-otherbuild,}.lintian: remove outdated
     overrides.
   * debhelper.in/libc.postinst: restart NSS services on upgrades from 
-    versions prior to 2.9-1.  Closes: bug#517094.
+    versions prior to 2.9-1.
   * testsuite-checking/expected-results-arm-linux-gnueabi-libc: ignore 
     result of test-fenv.out and test-fpucw.out, as they were already
     failing with glibc 2.7.
@@ -22,6 +22,8 @@
   * debian/rules.d/info.mk: new file to dump useful info in the build log.
   * debian/rules: always define and export SHELL as "/bin/bash -e".  
     Closes: bug#517077.
+  * patches/any/cvs-bz7058-nss_nss-nis.diff: new patch to fix crash when
+    doing host lookup with nss-nis.  Closes: bug#517094.
 
  -- Aurelien Jarno <aurel32@debian.org>  Wed, 25 Feb 2009 16:29:25 +0100
 

Added: glibc-package/trunk/debian/patches/any/cvs-bz7058-nss_nss-nis.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/cvs-bz7058-nss_nss-nis.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/any/cvs-bz7058-nss_nss-nis.diff	2009-02-25 17:20:27 UTC (rev 3317)
@@ -0,0 +1,87 @@
+2008-12-07  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #7058]
+	* nis/nss_nis/nis-hosts.c (_nss_nis_gethostbyname4_r): Fix memory
+	handling for host name aliases.
+
+diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
+index 24d1363..e1db5f5 100644
+--- a/nis/nss_nis/nis-hosts.c
++++ b/nis/nss_nis/nis-hosts.c
+@@ -485,24 +485,6 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
+       return retval;
+     }
+ 
+-  struct parser_data data;
+-  struct hostent host;
+-  int parse_res = parse_line (result, &host, &data, buflen, errnop, AF_UNSPEC,
+-			      0);
+-  if (__builtin_expect (parse_res < 1, 0))
+-    {
+-      if (parse_res == -1)
+-	{
+-	  *herrnop = NETDB_INTERNAL;
+-	  return NSS_STATUS_TRYAGAIN;
+-	}
+-      else
+-	{
+-	  *herrnop = HOST_NOT_FOUND;
+-	  return NSS_STATUS_NOTFOUND;
+-	}
+-    }
+-
+   if (*pat == NULL)
+     {
+       uintptr_t pad = (-(uintptr_t) buffer
+@@ -524,16 +506,47 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
+       buflen -= sizeof (struct gaih_addrtuple);
+     }
+ 
+-  (*pat)->next = NULL;
+-  size_t h_name_len = strlen (host.h_name);
+-  if (h_name_len >= buflen)
++  uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data);
++  buffer += pad;
++
++  struct parser_data *data = (void *) buffer;
++
++  if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+     goto erange;
+-  (*pat)->name = memcpy (buffer, host.h_name, h_name_len + 1);
++  buflen -= pad;
++
++  struct hostent host;
++  int parse_res = parse_line (result, &host, data, buflen, errnop, AF_UNSPEC,
++			      0);
++  if (__builtin_expect (parse_res < 1, 0))
++    {
++      if (parse_res == -1)
++	{
++	  *herrnop = NETDB_INTERNAL;
++	  return NSS_STATUS_TRYAGAIN;
++	}
++      else
++	{
++	  *herrnop = HOST_NOT_FOUND;
++	  return NSS_STATUS_NOTFOUND;
++	}
++    }
++
++  (*pat)->next = NULL;
+   (*pat)->family = host.h_addrtype;
+   memcpy ((*pat)->addr, host.h_addr_list[0], host.h_length);
+   (*pat)->scopeid = 0;
+   assert (host.h_addr_list[1] == NULL);
+ 
++  /* Undo the alignment for parser_data.  */
++  buffer -= pad;
++  buflen += pad;
++
++  size_t h_name_len = strlen (host.h_name) + 1;
++  if (h_name_len >= buflen)
++    goto erange;
++  (*pat)->name = memcpy (buffer, host.h_name, h_name_len);
++
+   free (result);
+ 
+   return NSS_STATUS_SUCCESS;

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2009-02-25 16:42:39 UTC (rev 3316)
+++ glibc-package/trunk/debian/patches/series	2009-02-25 17:20:27 UTC (rev 3317)
@@ -187,3 +187,4 @@
 any/cvs-pthread_h.diff
 any/local-bashisms.diff
 any/submitted-futex_lock_pi.diff
+any/cvs-bz7058-nss_nss-nis.diff


Reply to: