diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | posix/glob.c | 4 |
3 files changed, 12 insertions, 2 deletions
@@ -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-10-21 Florian Weimer <fweimer@redhat.com> * posix/Makefile (tests): Add tst-glob-tilde. @@ -100,6 +100,10 @@ Version 2.22.1 from a one-byte overflow during ~ operator processing (either on the stack or the heap, depending on the length of the user name). +* 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 cd28dc52a2..944b77b4dd 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -866,11 +866,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 |