summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/w/pr_time.c5
-rw-r--r--usr.bin/w/w.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/w/pr_time.c b/usr.bin/w/pr_time.c
index 30eecdf9c8e..7bf6b7ed988 100644
--- a/usr.bin/w/pr_time.c
+++ b/usr.bin/w/pr_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pr_time.c,v 1.7 1996/07/13 17:24:50 deraadt Exp $ */
+/* $OpenBSD: pr_time.c,v 1.8 1997/03/25 21:25:59 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -81,7 +81,8 @@ pr_attime(started, now)
(void)strcpy(fmt, __CONCAT("%l:%", "M%p"));
}
- (void)strftime(buf, sizeof(buf), fmt, tp);
+ (void)strftime(buf, sizeof(buf) -1, fmt, tp);
+ buf[sizeof buf - 1] = '\0';
(void)printf("%s", buf);
}
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);
/*