mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
libulog: Make sure ut_line, ut_user, ut_host are terminated.
MFC after: 3 days
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D45004
(cherry picked from commit c28253ecde
)
This commit is contained in:
parent
f8575d4e47
commit
3f59eb3141
@ -50,7 +50,7 @@ ulog_fill(struct utmpx *utx, const char *line)
|
||||
|
||||
utx->ut_pid = getpid();
|
||||
gettimeofday(&utx->ut_tv, NULL);
|
||||
strncpy(utx->ut_line, line, sizeof utx->ut_line);
|
||||
strlcpy(utx->ut_line, line, sizeof utx->ut_line);
|
||||
|
||||
SHA1_Init(&c);
|
||||
SHA1_Update(&c, "libulog", 7);
|
||||
@ -67,9 +67,9 @@ ulog_login(const char *line, const char *user, const char *host)
|
||||
|
||||
ulog_fill(&utx, line);
|
||||
utx.ut_type = USER_PROCESS;
|
||||
strncpy(utx.ut_user, user, sizeof utx.ut_user);
|
||||
strlcpy(utx.ut_user, user, sizeof utx.ut_user);
|
||||
if (host != NULL)
|
||||
strncpy(utx.ut_host, host, sizeof utx.ut_host);
|
||||
strlcpy(utx.ut_host, host, sizeof utx.ut_host);
|
||||
pututxline(&utx);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user