arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh1504809-2.patch

147e83
commit a159b53fa059947cc2548e3b0d5bdcf7b9630ba8
147e83
Author: Paul Eggert <eggert@cs.ucla.edu>
147e83
Date:   Sun Oct 22 10:00:57 2017 +0200
147e83
147e83
    glob: Fix buffer overflow during GLOB_TILDE unescaping [BZ #22332]
147e83
147e83
CVE-2017-15804 was assigned to this issue after commit.
147e83
147e83
diff --git a/posix/glob.c b/posix/glob.c
147e83
index 15cf3d5cccab0ee0..e09314712d68c1b8 100644
147e83
--- a/posix/glob.c
147e83
+++ b/posix/glob.c
147e83
@@ -806,11 +806,11 @@ glob (pattern, flags, errfunc, pglob)
147e83
 		  char *p = mempcpy (newp, dirname + 1,
147e83
 				     unescape - dirname - 1);
147e83
 		  char *q = unescape;
147e83
-		  while (*q != '\0')
147e83
+		  while (q != end_name)
147e83
 		    {
147e83
 		      if (*q == '\\')
147e83
 			{
147e83
-			  if (q[1] == '\0')
147e83
+			  if (q + 1 == end_name)
147e83
 			    {
147e83
 			      /* "~fo\\o\\" unescape to user_name "foo\\",
147e83
 				 but "~fo\\o\\/" unescape to user_name