[2.26 COMMITTED] CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320]

Florian Weimer fweimer@redhat.com
Sun Jan 1 00:00:00 GMT 2017


From: Paul Eggert <eggert@cs.ucla.edu>

(cherry picked from commit c369d66e5426a30e4725b100d5cd28e372754f90)

2017-10-20  Paul Eggert <eggert@cs.ucla.edu>

	[BZ #22320]
	CVE-2017-15670
	* posix/glob.c (__glob): Fix one-byte overflow.

diff --git a/NEWS b/NEWS
index ddc950c6cf..80248fec89 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,11 @@ Security related changes:
   vulnerability; only trusted binaries must be examined using the ldd
   script.)
 
+  CVE-2017-15670: The glob function, when invoked with GLOB_TILDE,
+  suffered from a one-byte overflow during ~ operator processing (either
+  on the stack or the heap, depending on the length of the user name).
+  Reported by Tim Rühsen.
+
 The following bugs are resolved with this release:
 
   [16750] ldd: Never run file directly.
diff --git a/posix/glob.c b/posix/glob.c
index a7eccf9cb4..c761c0861d 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -870,7 +870,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 		  *p = '\0';
 		}
 	      else
-		*((char *) mempcpy (newp, dirname + 1, end_name - dirname))
+		*((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1))
 		  = '\0';
 	      user_name = newp;
 	    }



More information about the Libc-stable mailing list