summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-03-25 21:24:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-03-25 21:24:13 +0000
commit7e015a55d891b126829fa7e6d642ebf7b0000da1 (patch)
treee8648eb8137576e309a70164ee8b0f48f566e81b /usr.bin
parent673af8f2eade72a44f7b016c1e17d0f221d4a2a0 (diff)
ensure strftime buf has NUL; yokota@freebsd
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/w/w.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index cde920bc31c..380f19b3534 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.13 1997/02/19 11:16:04 angelos Exp $ */
+/* $OpenBSD: w.c,v 1.14 1997/03/25 21:24:12 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -384,8 +384,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);
/*