From 2d1bd71ec70a31b01d01b734faa66bb1ed28961f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 19 Oct 2017 12:39:45 -0700 Subject: glob: fix heap buffer overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib/glob.c (glob): Fix off-by-one error introduced into glibc in commit dd7d45e838a42b0ed470c44b55901ea98d0c2bab dated 1997-10-29 20:33:40. Problem reported by Tim Rühsen in: https://sourceware.org/bugzilla/show_bug.cgi?id=22320 Fix suggested by Bruno Haible. --- lib/glob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/glob.c') diff --git a/lib/glob.c b/lib/glob.c index 33030ec72b..67530431e4 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -764,7 +764,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; } -- cgit v1.2.1