[PATCH 2.22 05/14] glob: Fix buffer overflow during GLOB_TILDE unescaping [BZ #22332]
Raphael Moreira Zinsly
rzinsly@linux.vnet.ibm.com
Mon Jan 1 00:00:00 GMT 2018
From: Paul Eggert <eggert@cs.ucla.edu>
(cherry picked from commit a159b53fa059947cc2548e3b0d5bdcf7b9630ba8)
---
ChangeLog | 6 ++++++
NEWS | 4 ++++
posix/glob.c | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7af97cd..4b87910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-22 Paul Eggert <eggert@cs.ucla.edu>
+
+ [BZ #22332]
+ * posix/glob.c (__glob): Fix buffer overflow during GLOB_TILDE
+ unescaping.
+
2017-02-27 Florian Weimer <fweimer@redhat.com>
[BZ #21115]
diff --git a/NEWS b/NEWS
index ef34252..314a443 100644
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,10 @@ Version 2.22.1
* A use-after-free vulnerability in clntudp_call in the Sun RPC system has been
fixed (CVE-2017-12133).
+* CVE-2017-15804: The glob function, when invoked with GLOB_TILDE and without
+ GLOB_NOESCAPE, could write past the end of a buffer while
+ unescaping user names. Reported by Tim Rühsen.
+
Version 2.22
diff --git a/posix/glob.c b/posix/glob.c
index 40496a0..c4c0532 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -839,11 +839,11 @@ glob (pattern, flags, errfunc, pglob)
char *p = mempcpy (newp, dirname + 1,
unescape - dirname - 1);
char *q = unescape;
- while (*q != '\0')
+ while (q != end_name)
{
if (*q == '\\')
{
- if (q[1] == '\0')
+ if (q + 1 == end_name)
{
/* "~fo\\o\\" unescape to user_name "foo\\",
but "~fo\\o\\/" unescape to user_name
--
1.8.3.1
More information about the Libc-stable
mailing list