]> Savannah Git Hosting - gnulib.git/commitdiff
glob: fix heap buffer overflow
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 19 Oct 2017 19:39:45 +0000 (12:39 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 19 Oct 2017 19:40:31 +0000 (12:40 -0700)
* 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.

ChangeLog
lib/glob.c

index b280a7753dd5a6f302293a9d688149f0ca7b07ce..e662c02a57a1900cfe9cd659579b100f4b98d3c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-10-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       glob: fix heap buffer overflow
+       * 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.
+
 2017-10-18  Paul Eggert  <eggert@cs.ucla.edu>
 
        glob: pacify fuzzer for mempcpy
index 33030ec72bb2502a2b93823c5e02bbf40ac195ae..67530431e4b82a3f76c07a573607b00534029365 100644 (file)
@@ -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;
             }