about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-09-25 19:38:15 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-09-27 21:40:59 +0000
commit6d3997c51bad9d5d64135a7b4a92201ea158cf60 (patch)
treef899a156d2c2e25d6f0acf5e93b3912a3be9f025
parent8a780f7f68a1cd4c575bb17973a9e18826b05ef9 (diff)
downloadglibc-6d3997c51bad9d5d64135a7b4a92201ea158cf60.tar.gz
glibc-6d3997c51bad9d5d64135a7b4a92201ea158cf60.tar.xz
glibc-6d3997c51bad9d5d64135a7b4a92201ea158cf60.zip
Use size_t instead of int for internal variables in glob (bug 14621).
(cherry picked from commit b87c4b24d97321ef2f2da357f8fcf11f1f61e3dc)

Conflicts:

	ChangeLog
-rw-r--r--ChangeLog8
-rw-r--r--NEWS3
-rw-r--r--posix/glob.c10
3 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b4b6254b5d..a0b960ce40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-09-25  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #14621]
+	* posix/glob.c (next_brace_sub): Use size_t instead of unsigned
+	int as type of variable DEPTH.
+	(glob): Use size_t instead of int as type of variables NEWCOUNT
+	and OLD_PATHC.
+
 2012-08-27  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #14459]
diff --git a/NEWS b/NEWS
index 7869476da8..ad5006820e 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,8 @@ Version 2.15.1
 * The following bugs are resolved with this release:
 
   411, 2547, 2548, 11365, 11494, 13583, 13731, 13732, 13733, 13747, 13748,
-  13749, 13753, 13771, 13774, 13786, 14048, 14059, 14167, 14273, 14459
+  13749, 13753, 13771, 13774, 13786, 14048, 14059, 14167, 14273, 14459,
+  14621
 
 Version 2.15
 
diff --git a/posix/glob.c b/posix/glob.c
index 89c8775109..a44f4cc89b 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -218,7 +218,7 @@ static int collated_compare (const void *, const void *) __THROW;
 static const char *
 next_brace_sub (const char *cp, int flags)
 {
-  unsigned int depth = 0;
+  size_t depth = 0;
   while (*cp != '\0')
     if ((flags & GLOB_NOESCAPE) == 0 && *cp == '\\')
       {
@@ -961,7 +961,7 @@ glob (pattern, flags, errfunc, pglob)
 		  && S_ISDIR (st.st_mode))
 	       : (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode)))))
 	{
-	  int newcount = pglob->gl_pathc + pglob->gl_offs;
+	  size_t newcount = pglob->gl_pathc + pglob->gl_offs;
 	  char **new_gl_pathv;
 
 	  if (newcount > UINTPTR_MAX - (1 + 1)
@@ -1060,7 +1060,7 @@ glob (pattern, flags, errfunc, pglob)
 	 appending the results to PGLOB.  */
       for (i = 0; i < dirs.gl_pathc; ++i)
 	{
-	  int old_pathc;
+	  size_t old_pathc;
 
 #ifdef	SHELL
 	  {
@@ -1115,7 +1115,7 @@ glob (pattern, flags, errfunc, pglob)
 	  /* No matches.  */
 	  if (flags & GLOB_NOCHECK)
 	    {
-	      int newcount = pglob->gl_pathc + pglob->gl_offs;
+	      size_t newcount = pglob->gl_pathc + pglob->gl_offs;
 	      char **new_gl_pathv;
 
 	      if (newcount > UINTPTR_MAX - 2
@@ -1159,7 +1159,7 @@ glob (pattern, flags, errfunc, pglob)
     }
   else
     {
-      int old_pathc = pglob->gl_pathc;
+      size_t old_pathc = pglob->gl_pathc;
       int orig_flags = flags;
 
       if (meta & 2)