diff options
author | yokota <yokota@FreeBSD.org> | 1997-03-07 10:54:19 +0000 |
---|---|---|
committer | yokota <yokota@FreeBSD.org> | 1997-03-07 10:54:19 +0000 |
commit | 479436ac99420a9f21448ceff38e56f9891b74de (patch) | |
tree | beb69aee2112caa7c3cb9c304c017b413cc94e78 /usr.bin/w/w.c | |
parent | 8c8965349ae8918a5418c8ab2b62a321b6359481 (diff) | |
download | FreeBSD-src-479436ac99420a9f21448ceff38e56f9891b74de.zip FreeBSD-src-479436ac99420a9f21448ceff38e56f9891b74de.tar.gz |
Made sure the string formated by strftime() is properly
null-terminated.
Should go to RELENG_2_1 and RELENG_2_2.
Reviewed by guido@freebsd.org.
Diffstat (limited to 'usr.bin/w/w.c')
-rw-r--r-- | usr.bin/w/w.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index c615430..f027997 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -377,8 +377,9 @@ pr_header(nowp, nusers) * SCCS forces the string manipulation below, as it replaces * %, M, and % in a character string with the file name. */ - (void)strftime(buf, sizeof(buf), + (void)strftime(buf, sizeof(buf) - 1, __CONCAT("%l:%","M%p"), localtime(nowp)); + buf[sizeof(buf) - 1] = '\0'; (void)printf("%s ", buf); /* |