summaryrefslogtreecommitdiff
path: root/usr.bin/who
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-14 03:13:08 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-14 03:13:08 +0000
commit797124dfd8f639854e810c5ac6a10e4014f56531 (patch)
tree07201ca8f46925b6c86dbab5566043544a188e5a /usr.bin/who
parent1cbe81fe700041eed43e09f84815b6cb3ac124bb (diff)
strlcat, but i memset 0 before to be safe
Diffstat (limited to 'usr.bin/who')
-rw-r--r--usr.bin/who/who.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index 1089ba84b64..37116759072 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: who.c,v 1.13 2003/04/07 21:14:28 deraadt Exp $ */
+/* $OpenBSD: who.c,v 1.14 2003/04/14 03:13:07 deraadt Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: who.c,v 1.13 2003/04/07 21:14:28 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: who.c,v 1.14 2003/04/14 03:13:07 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -231,8 +231,9 @@ output(up)
if (now == 0)
time(&now);
- strcpy(line, _PATH_DEV);
- strncat(line, up->ut_line, sizeof (up->ut_line));
+ memset(line, 0, sizeof line);
+ strlcpy(line, _PATH_DEV, sizeof line);
+ strlcat(line, up->ut_line, sizeof line);
if (stat(line, &sb) == 0) {
state = (sb.st_mode & 020) ? '+' : '-';