summaryrefslogtreecommitdiff
path: root/src/stat.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-03-12 10:54:20 +0000
committerJim Meyering <jim@meyering.net>2005-03-12 10:54:20 +0000
commitd9d98362233ab51869b8829f91d70f37a54be5a5 (patch)
tree28ef57604883d91b52bc1f431baa06fbca5b57be /src/stat.c
parent2c84165280fc54492039d9be1569cb294755abf4 (diff)
downloadcoreutils-d9d98362233ab51869b8829f91d70f37a54be5a5.tar.xz
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.
Diffstat (limited to 'src/stat.c')
-rw-r--r--src/stat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stat.c b/src/stat.c
index f9f145918..2f4609c90 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)