From d9d98362233ab51869b8829f91d70f37a54be5a5 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 12 Mar 2005 10:54:20 +0000 Subject: [PATCH] Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s, could cause a buffer overrun error. (print_it): Allocate 2 more bytes, to accommodate our conversion of the stat %s format string to the longer printf %llu one. Patch from Guochun Shi. --- src/stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stat.c b/src/stat.c index f9f1459189..2f4609c902 100644 --- a/src/stat.c +++ b/src/stat.c @@ -534,7 +534,7 @@ print_it (char const *masterformat, char const *filename, /* create a working copy of the format string */ char *format = xstrdup (masterformat); - char *dest = xmalloc (strlen (format) + 1); + char *dest = xmalloc (strlen (format) + 2 + 1); b = format; while (b) -- 2.47.3