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

r4748 - glibc-package/trunk/debian/patches/any



Author: aurel32
Date: 2011-06-26 20:52:44 +0000 (Sun, 26 Jun 2011)
New Revision: 4748

Added:
   glibc-package/trunk/debian/patches/any/cvs-fnmatch.diff
Log:
Add patch missing from previous commit


Added: glibc-package/trunk/debian/patches/any/cvs-fnmatch.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/cvs-fnmatch.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/any/cvs-fnmatch.diff	2011-06-26 20:52:44 UTC (rev 4748)
@@ -0,0 +1,35 @@
+2011-03-18  Ulrich Drepper  <drepper@gmail.com>
+
+	* posix/fnmatch.c (fnmatch): Check size of pattern in wide
+	character representation.
+	Partly based on a patch by Tomas Hoger <thoger@redhat.com>.
+
+diff --git a/posix/fnmatch.c b/posix/fnmatch.c
+index 0af5ee6..819a6a7 100644
+--- a/posix/fnmatch.c
++++ b/posix/fnmatch.c
+@@ -375,6 +375,11 @@ fnmatch (pattern, string, flags)
+ 	       XXX Do we have to set `errno' to something which mbsrtows hasn't
+ 	       already done?  */
+ 	    return -1;
++	  if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
++	    {
++	      __set_errno (ENOMEM);
++	      return -2;
++	    }
+ 	  wpattern_malloc = wpattern
+ 	    = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
+ 	  assert (mbsinit (&ps));
+@@ -419,6 +424,12 @@ fnmatch (pattern, string, flags)
+ 	       XXX Do we have to set `errno' to something which mbsrtows hasn't
+ 	       already done?  */
+ 	    goto free_return;
++	  if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
++	    {
++	      free (wpattern_malloc);
++	      __set_errno (ENOMEM);
++	      return -2;
++	    }
+ 
+ 	  wstring_malloc = wstring
+ 	    = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));


Reply to: