summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-30 00:15:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-30 00:15:14 +0000
commit0e3b7dd62f00bc51db18ed8d9b2eba4fa208b948 (patch)
treef4d5e6a250ceac3678d75ebea3727f201b4aba57 /lib/libc/gen
parent2ea5f3768b285cd1c34b9b9d4c27c1f7d5b8d83c (diff)
be even more careful with strlcpy()
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/exec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c
index 9341d4f4c4d..b47f3b15b04 100644
--- a/lib/libc/gen/exec.c
+++ b/lib/libc/gen/exec.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: exec.c,v 1.12 2002/02/19 19:39:36 millert Exp $";
+static char rcsid[] = "$OpenBSD: exec.c,v 1.13 2002/07/30 00:15:13 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -142,7 +142,7 @@ execvp(name, argv)
char * const *argv;
{
char **memp;
- register int cnt, lp, ln;
+ register int cnt, lp, ln, len;
register char *p;
int eacces = 0;
char *bp, *cur, *path, buf[MAXPATHLEN];
@@ -166,12 +166,13 @@ execvp(name, argv)
/* Get the path we're searching. */
if (!(path = getenv("PATH")))
path = _PATH_DEFPATH;
- cur = alloca(strlen(path) + 1);
+ len = strlen(path) + 1;
+ cur = alloca(len);
if (cur == NULL) {
errno = ENOMEM;
return (-1);
}
- strcpy(cur, path);
+ strlcpy(cur, path, len);
path = cur;
while ((p = strsep(&cur, ":"))) {
/*