mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-26 11:47:31 +00:00
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.
This commit is contained in:
parent
d36dc5e36b
commit
6d7977a7cc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=23493
@ -76,7 +76,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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user