diff options
author | Jim Meyering <jim@meyering.net> | 2005-03-12 10:54:20 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2005-03-12 10:54:20 +0000 |
commit | d9d98362233ab51869b8829f91d70f37a54be5a5 (patch) | |
tree | 28ef57604883d91b52bc1f431baa06fbca5b57be | |
parent | 2c84165280fc54492039d9be1569cb294755abf4 (diff) | |
download | coreutils-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.
-rw-r--r-- | src/stat.c | 2 |
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) |