diff options
author | mike <mike@FreeBSD.org> | 2001-08-13 05:56:27 +0000 |
---|---|---|
committer | mike <mike@FreeBSD.org> | 2001-08-13 05:56:27 +0000 |
commit | 24fb11b75c2fb56a4793d795e37287e57f5676b7 (patch) | |
tree | 1cb173e03bd681628710ae6e091511332a35b1c3 /usr.bin/login/login.c | |
parent | 49568467b45dc390f37ede6491d231082f2aa6b7 (diff) | |
download | FreeBSD-src-24fb11b75c2fb56a4793d795e37287e57f5676b7.zip FreeBSD-src-24fb11b75c2fb56a4793d795e37287e57f5676b7.tar.gz |
Fix some bogus strncpy(3) to strlcpy(3) changes I made in the previous
revision. <utmp.h> structures don't leave room for a NUL character.
Also fix "UNKNOWN" which should have just been UNKNOWN.
Pointed out by: bde
Diffstat (limited to 'usr.bin/login/login.c')
-rw-r--r-- | usr.bin/login/login.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index b3a25e1..6fd34f5 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -509,10 +509,10 @@ main(argc, argv) /* Nothing else left to fail -- really log in. */ memset((void *)&utmp, 0, sizeof(utmp)); (void)time(&utmp.ut_time); - (void)strlcpy(utmp.ut_name, username, sizeof(utmp.ut_name)); + (void)strncpy(utmp.ut_name, username, sizeof(utmp.ut_name)); if (hostname) - (void)strlcpy(utmp.ut_host, hostname, sizeof(utmp.ut_host)); - (void)strlcpy(utmp.ut_line, tty, sizeof(utmp.ut_line)); + (void)strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host)); + (void)strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line)); login(&utmp); dolastlog(quietlog); @@ -1011,9 +1011,9 @@ dolastlog(quiet) } memset((void *)&ll, 0, sizeof(ll)); (void)time(&ll.ll_time); - (void)strlcpy(ll.ll_line, tty, sizeof(ll.ll_line)); + (void)strncpy(ll.ll_line, tty, sizeof(ll.ll_line)); if (hostname) - (void)strlcpy(ll.ll_host, hostname, sizeof(ll.ll_host)); + (void)strncpy(ll.ll_host, hostname, sizeof(ll.ll_host)); (void)write(fd, (char *)&ll, sizeof(ll)); (void)close(fd); } else { @@ -1058,7 +1058,7 @@ stypeof(ttyid) if (t != NULL && t->ty_type != NULL) return (t->ty_type); } - return ("UNKNOWN"); + return (UNKNOWN); } void |