diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-04 00:42:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-04 00:42:35 +0000 |
commit | daf329b1c0f01bbdd4028168949c69860a248f9e (patch) | |
tree | ca613584d0fe67c96c9239325b37011daa2ef3cc /usr.bin/which/which.c | |
parent | 51ea99310ccd7f074f3727add189ec97cde8b868 (diff) |
snprintf & strlcpy; tedu ok
Diffstat (limited to 'usr.bin/which/which.c')
-rw-r--r-- | usr.bin/which/which.c | 8 |
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); |