summaryrefslogtreecommitdiffstats
path: root/usr.bin/which
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-04-04 00:42:34 +0000
committerderaadt <deraadt@openbsd.org>2003-04-04 00:42:34 +0000
commit9e405e780cca0470cd5ff0367b3f0c79ee63379b (patch)
treea250fe89ec2068c75623c6de852eabf626bd90b1 /usr.bin/which
parentlower the max kernel vm address since there might be proms right below the io (diff)
downloadwireguard-openbsd-9e405e780cca0470cd5ff0367b3f0c79ee63379b.tar.xz
wireguard-openbsd-9e405e780cca0470cd5ff0367b3f0c79ee63379b.zip
snprintf & strlcpy; tedu ok
Diffstat (limited to 'usr.bin/which')
-rw-r--r--usr.bin/which/which.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/which/which.c b/usr.bin/which/which.c
index fef3eb6b0b5..1d4dac5fc86 100644
--- a/usr.bin/which/which.c
+++ b/usr.bin/which/which.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: which.c,v 1.6 2002/02/16 21:27:59 millert Exp $ */
+/* $OpenBSD: which.c,v 1.7 2003/04/04 00:42:34 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -28,7 +28,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: which.c,v 1.6 2002/02/16 21:27:59 millert Exp $";
+static char rcsid[] = "$OpenBSD: which.c,v 1.7 2003/04/04 00:42:34 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -162,9 +162,9 @@ findprog(prog, path, progmode, allmatches)
return(0);
}
- (void)strcpy(filename, p);
+ (void)strlcpy(filename, p, sizeof filename);
filename[plen] = '/';
- (void)strcpy(filename + plen + 1, prog);
+ (void)strlcpy(filename + plen + 1, prog, sizeof filename - (plen + 1));
if ((stat(filename, &sbuf) == 0) && S_ISREG(sbuf.st_mode) &&
access(filename, X_OK) == 0) {
(void)puts(filename);