diff options
author | Doug Barton <dougb@FreeBSD.org> | 2010-12-05 20:47:53 +0000 |
---|---|---|
committer | Doug Barton <dougb@FreeBSD.org> | 2010-12-05 20:47:53 +0000 |
commit | 578800b575fc83f2012668f24bee8ccd0df10c4c (patch) | |
tree | 6321176ea88e31db722428ba079d0336b894bee3 /usr.bin/stat | |
parent | 5af61b5251221b7977a769bc13c2e86e81952293 (diff) | |
download | src-578800b575fc83f2012668f24bee8ccd0df10c4c.tar.gz src-578800b575fc83f2012668f24bee8ccd0df10c4c.zip |
Bring in the change from NetBSD 1.22:
"Fix a trivial truncation case, and eliminate a corner case that might
print a nul character."
I am purposely bypassing the following versions:
1.19 A build infrastructure change that does not apply to us
1.20 A feature I am not interested in, but don't object if someone else
wants to pick it up
1.21 A build infrastructure change that does not apply to us
Obtained from: atatat@NetBSD.org
Notes
Notes:
svn path=/head/; revision=216202
Diffstat (limited to 'usr.bin/stat')
-rw-r--r-- | usr.bin/stat/stat.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c index 63c242b9b9b0..a56927edeeac 100644 --- a/usr.bin/stat/stat.c +++ b/usr.bin/stat/stat.c @@ -30,7 +30,7 @@ #include <sys/cdefs.h> #if 0 #ifndef lint -__RCSID("$NetBSD: stat.c,v 1.18 2004/05/28 04:48:31 atatat Exp $"); +__RCSID("$NetBSD: stat.c,v 1.22 2005/04/22 03:36:48 atatat Exp $"); #endif #endif @@ -381,7 +381,7 @@ output(const struct stat *st, const char *file, const char *statfmt, int fn, int nonl, int quiet) { int flags, size, prec, ofmt, hilo, what; - char buf[PATH_MAX]; + char buf[PATH_MAX + 4 + 1]; const char *subfmt; int nl, t, i; @@ -550,7 +550,7 @@ output(const struct stat *st, const char *file, buf, sizeof(buf), flags, size, prec, ofmt, hilo, what); - for (i = 0; i < t && i < sizeof(buf); i++) + for (i = 0; i < t && i < sizeof(buf) - 1; i++) addchar(stdout, buf[i], &nl); continue; |