diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-10-27 23:02:24 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-10-27 23:02:24 +0000 |
commit | 07f37870a0f2ff2e737cdc8a6c2e9b7f8da3f7f0 (patch) | |
tree | ac67fc92780d9f5d9b35b1b2ea5fb04ff2ba9ed3 /lib | |
parent | bfda6893cf2f9740fb3b4decefbc43d3e89c67d0 (diff) |
exec[lv]p() shall return ENOENT for empty path names
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/exec.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index 873f05c772f..ad4e2c7ca1e 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.3 1996/08/19 08:22:40 tholo Exp $"; +static char rcsid[] = "$OpenBSD: exec.c,v 1.4 1996/10/27 23:02:23 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -187,6 +187,14 @@ execvp(name, argv) int eacces = 0, etxtbsy = 0; char *bp, *cur, *path, buf[MAXPATHLEN]; + /* + * Do not allow null name + */ + if (name == NULL || *name == '\0') { + errno = ENOENT; + return (-1); + } + /* If it's an absolute or relative path name, it's easy. */ if (strchr(name, '/')) { bp = (char *)name; |