summaryrefslogtreecommitdiffstats
path: root/usr.bin/who
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-04-14 03:13:07 +0000
committerderaadt <deraadt@openbsd.org>2003-04-14 03:13:07 +0000
commit8914c8687daea0f03864b235d0eae0a6c8224317 (patch)
tree8bec88510d3b078d977feeeea5a7b6bb8ac80345 /usr.bin/who
parentstring cleaning; my bugs found by millert and krw (diff)
downloadwireguard-openbsd-8914c8687daea0f03864b235d0eae0a6c8224317.tar.xz
wireguard-openbsd-8914c8687daea0f03864b235d0eae0a6c8224317.zip
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) ? '+' : '-';