mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Made sure the string formated by strftime() is properly
null-terminated. Fixed a wrong if statement which should test a string is empty where in fact it tested the string pointer was NULL. Should go to RELENG_2_1 and RELENG_2_2. Reviewed by guido@freebsd.org.
This commit is contained in:
parent
6d7977a7cc
commit
719ed69ecf
1 changed files with 2 additions and 1 deletions
|
|
@ -87,7 +87,7 @@ main(argc, argv)
|
|||
if (t = rindex(p, '/'))
|
||||
p = t + 1;
|
||||
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1)
|
||||
if (usr.ut_name && !strcmp(usr.ut_line, p)) {
|
||||
if (*usr.ut_name && !strcmp(usr.ut_line, p)) {
|
||||
output(&usr);
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -116,6 +116,7 @@ output(up)
|
|||
(void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE, up->ut_name,
|
||||
UT_LINESIZE, UT_LINESIZE, up->ut_line);
|
||||
(void)strftime(buf, sizeof(buf), "%c", localtime(&up->ut_time));
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
(void)printf("%.12s", buf + 4);
|
||||
if (*up->ut_host)
|
||||
printf("\t(%.*s)", UT_HOSTSIZE, up->ut_host);
|
||||
|
|
|
|||
Loading…
Reference in a new issue