summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ac
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2001-05-05 07:12:50 +0000
committermickey <mickey@openbsd.org>2001-05-05 07:12:50 +0000
commit4f77c0ac81914da49deed40fd3af4307fa284937 (patch)
treebc85c0037c22f57528efb307250a9dc18297ebe8 /usr.sbin/ac
parentinstall other files too (diff)
downloadwireguard-openbsd-4f77c0ac81914da49deed40fd3af4307fa284937.tar.xz
wireguard-openbsd-4f77c0ac81914da49deed40fd3af4307fa284937.zip
use strlcpy vs strncpy+a[n-1]='\0'
Diffstat (limited to 'usr.sbin/ac')
-rw-r--r--usr.sbin/ac/ac.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c
index 1a57109acbb..cd166a73b45 100644
--- a/usr.sbin/ac/ac.c
+++ b/usr.sbin/ac/ac.c
@@ -14,7 +14,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: ac.c,v 1.7 1997/10/09 15:07:17 deraadt Exp $";
+static char rcsid[] = "$Id: ac.c,v 1.8 2001/05/05 07:12:50 mickey Exp $";
#endif
#include <sys/types.h>
@@ -129,8 +129,7 @@ add_tty(name)
tp->ret = 0;
name++;
}
- (void)strncpy(tp->name, name, sizeof (tp->name) - 1);
- tp->name[sizeof (tp->name) - 1] = '\0';
+ strlcpy(tp->name, name, sizeof (tp->name));
if ((rcp = strchr(tp->name, '*')) != NULL) { /* wild card */
*rcp = '\0';
tp->len = strlen(tp->name); /* match len bytes only */
@@ -210,8 +209,7 @@ update_user(head, name, secs)
if ((up = NEW(struct user_list)) == NULL)
err(1, "malloc");
up->next = head;
- (void)strncpy(up->name, name, sizeof (up->name) - 1);
- up->name[sizeof (up->name) - 1] = '\0'; /* paranoid! */
+ strlcpy(up->name, name, sizeof (up->name));
up->secs = secs;
Total += secs;
return up;
@@ -420,8 +418,7 @@ log_in(head, up)
/*
* this allows us to pick the right logout
*/
- (void)strncpy(up->ut_line, Console, sizeof (up->ut_line) - 1);
- up->ut_line[sizeof (up->ut_line) - 1] = '\0'; /* paranoid! */
+ strlcpy(up->ut_line, Console, sizeof (up->ut_line));
}
#endif
/*