diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-10-23 17:20:01 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-10-23 17:24:38 -0700 |
commit | 7d93a082b6e3ece0b120a5150d2020c7fa11b2f5 (patch) | |
tree | bf963fe6dfed9a7451f2a6e73d972f16ec14c4c4 /src | |
parent | d5d82ecf3b0f370216c12e0f8163f0a5249da91e (diff) | |
download | coreutils-7d93a082b6e3ece0b120a5150d2020c7fa11b2f5.tar.xz |
du: don't print junk when diagnosing out-of-range time stamps
* src/du.c (show_date): Fix call to fputs with a buffer that
contains some uninitialized data.
* tests/Makefile.am (TESTS): Add du/big-timestamp.
* tests/du/bigtime: New file, which checks for the bug.
Diffstat (limited to 'src')
-rw-r--r-- | src/du.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -351,8 +351,9 @@ show_date (const char *format, struct timespec when) if (! tm) { char buf[INT_BUFSIZE_BOUND (intmax_t)]; - error (0, 0, _("time %s is out of range"), timetostr (when.tv_sec, buf)); - fputs (buf, stdout); + char *when_str = timetostr (when.tv_sec, buf); + error (0, 0, _("time %s is out of range"), when_str); + fputs (when_str, stdout); return; } |