diff options
author | 1997-03-25 21:24:12 +0000 | |
---|---|---|
committer | 1997-03-25 21:24:12 +0000 | |
commit | 62e482e9d33ac10539baeff899cc0e565f9a50de (patch) | |
tree | daf75d80d664c88ea8544ed784670a84746d9da8 /usr.bin | |
parent | do not chmod file before unlink; firebug@atlantic.net (diff) | |
download | wireguard-openbsd-62e482e9d33ac10539baeff899cc0e565f9a50de.tar.xz wireguard-openbsd-62e482e9d33ac10539baeff899cc0e565f9a50de.zip |
ensure strftime buf has NUL; yokota@freebsd
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/w/pr_time.c | 5 | ||||
-rw-r--r-- | usr.bin/w/w.c | 5 |
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); /* |