r2312 - trunk/glibc

matthew at linuxfromscratch.org matthew at linuxfromscratch.org
Sun Aug 14 13:11:18 PDT 2011


Author: matthew
Date: 2011-08-14 14:11:12 -0600 (Sun, 14 Aug 2011)
New Revision: 2312

Added:
   trunk/glibc/glibc-2.14-fixes-1.patch
Log:
Add bug fix patch for Glibc-2.14.

Added: trunk/glibc/glibc-2.14-fixes-1.patch
===================================================================
--- trunk/glibc/glibc-2.14-fixes-1.patch	                        (rev 0)
+++ trunk/glibc/glibc-2.14-fixes-1.patch	2011-08-14 20:11:12 UTC (rev 2312)
@@ -0,0 +1,86 @@
+Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
+Date:                    2011-08-12
+Initial Package Version: 2.14
+Upstream Status:         From upstream
+Origin:                  Matt Burgess
+Description:             Fixes Firefox crashes and a core dump scenario when
+                         calling getopt()
+
+diff -Naur glibc-2.14.orig/posix/getopt.c glibc-2.14/posix/getopt.c
+--- glibc-2.14.orig/posix/getopt.c	2011-05-31 04:12:33.000000000 +0000
++++ glibc-2.14/posix/getopt.c	2011-08-12 20:39:34.343500879 +0000
+@@ -871,6 +871,9 @@
+     /* Convenience. Treat POSIX -W foo same as long option --foo */
+     if (temp[0] == 'W' && temp[1] == ';')
+       {
++	if (longopts == NULL)
++	  goto no_longs;
++
+ 	char *nameend;
+ 	const struct option *p;
+ 	const struct option *pfound = NULL;
+@@ -1086,8 +1089,10 @@
+ 	      }
+ 	    return pfound->val;
+ 	  }
+-	  d->__nextchar = NULL;
+-	  return 'W';	/* Let the application handle it.   */
++
++	no_longs:
++          d->__nextchar = NULL;
++          return 'W';	/* Let the application handle it.   */
+       }
+     if (temp[1] == ':')
+       {
+diff -Naur glibc-2.14.orig/resolv/res_query.c glibc-2.14/resolv/res_query.c
+--- glibc-2.14.orig/resolv/res_query.c	2011-05-31 04:12:33.000000000 +0000
++++ glibc-2.14/resolv/res_query.c	2011-08-12 20:31:45.871527332 +0000
+@@ -122,6 +122,7 @@
+ 		  int *resplen2)
+ {
+ 	HEADER *hp = (HEADER *) answer;
++	HEADER *hp2;
+ 	int n, use_malloc = 0;
+ 	u_int oflags = statp->_flags;
+ 
+@@ -239,26 +240,25 @@
+ 	  /* __libc_res_nsend might have reallocated the buffer.  */
+ 	  hp = (HEADER *) *answerp;
+ 
+-	/* We simplify the following tests by assigning HP to HP2.  It
+-	   is easy to verify that this is the same as ignoring all
+-	   tests of HP2.  */
+-	HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
+-
+-	if (n < (int) sizeof (HEADER) && answerp2 != NULL
+-	    && *resplen2 > (int) sizeof (HEADER))
++	/* We simplify the following tests by assigning HP to HP2 or
++	   vice versa.  It is easy to verify that this is the same as
++	   ignoring all tests of HP or HP2.  */
++	if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
+ 	  {
+-	    /* Special case of partial answer.  */
+-	    assert (hp != hp2);
+-	    hp = hp2;
++	    hp2 = hp;
+ 	  }
+-	else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
+-		 && n > (int) sizeof (HEADER))
++	else
+ 	  {
+-	    /* Special case of partial answer.  */
+-	    assert (hp != hp2);
+-	    hp2 = hp;
++	    hp2 = (HEADER *) *answerp2;
++	    if (n < (int) sizeof (HEADER))
++	      {
++	        hp = hp2;
++	      }
+ 	  }
+ 
++	/* Make sure both hp and hp2 are defined */
++	assert((hp != NULL) && (hp2 != NULL));
++
+ 	if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
+ 	    && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
+ #ifdef DEBUG




More information about the patches mailing list