diff options
author | 1996-10-27 23:02:23 +0000 | |
---|---|---|
committer | 1996-10-27 23:02:23 +0000 | |
commit | bc7570683c43581736a9be1ef83e037c88e279ab (patch) | |
tree | 35fbc3a865467942561a2c817a80b0a13ca4ae67 | |
parent | Correct error return for link(2) to directories (diff) | |
download | wireguard-openbsd-bc7570683c43581736a9be1ef83e037c88e279ab.tar.xz wireguard-openbsd-bc7570683c43581736a9be1ef83e037c88e279ab.zip |
exec[lv]p() shall return ENOENT for empty path names
-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; |