summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-02-07 08:47:50 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-02-07 08:47:50 +0000
commit733b8ddeaa2092cbd26c1b1ff98d8a4891603f7b (patch)
tree1fd140680f08f31a79ab2cfade959c13880e7ef3 /sys/kern/kern_exec.c
parent415c7be72eb838388ba7270b14a9c5dc850beef7 (diff)
forbid execve() with argc == 0. prompted by a millert email.
ok deraadt miod
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index d71053b77ea..1a83972782d 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.157 2015/01/26 22:51:37 kettenis Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.158 2015/02/07 08:47:49 tedu Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -373,6 +373,12 @@ sys_execve(struct proc *p, void *v, register_t *retval)
argc++;
}
+ /* must have at least one argument */
+ if (argc == 0) {
+ error = EINVAL;
+ goto bad;
+ }
+
envc = 0;
/* environment does not need to be there */
if ((cpp = SCARG(uap, envp)) != NULL ) {