Oops, the code uses one more array element than allocated.
Found with 'valgrind'.
Fixed like this:


2025-05-04  Bruno Haible  <br...@clisp.org>

        vc-mtime: Fix a buffer overflow.
        * lib/vc-mtime.c (max_vc_mtime): Increase the size of argv by one
        element.

diff --git a/lib/vc-mtime.c b/lib/vc-mtime.c
index 4091e34123..ad529ea317 100644
--- a/lib/vc-mtime.c
+++ b/lib/vc-mtime.c
@@ -573,7 +573,7 @@ max_vc_mtime (struct timespec *max_of_mtimes,
                 }
 
               /* Room for passing arguments to git commands.  */
-              const char **argv = XNMALLOC (6 + nfiles + 1, const char *);
+              const char **argv = XNMALLOC (7 + nfiles + 1, const char *);
 
               {
                 /* Put the relative file names into a hash table.  This is 
needed




Reply via email to