summaryrefslogtreecommitdiff
path: root/sys/kern/exec_script.c
diff options
context:
space:
mode:
authormaxv <maxv@NetBSD.org>2014-06-30 17:22:32 +0000
committermaxv <maxv@NetBSD.org>2014-06-30 17:22:32 +0000
commit8d04aaa30c70eadf29d536c5b3c09c68e7797611 (patch)
tree524af6a0e58df56315305e2db71601a7a310f9c6 /sys/kern/exec_script.c
parentf53e3f84eb531b7b26b3829c6d2ad465b7bbab23 (diff)
If the interpreter is "", do not keep loading the script (which will later
fail), but return ENOEXEC directly. ok christos@
Diffstat (limited to 'sys/kern/exec_script.c')
-rw-r--r--sys/kern/exec_script.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index 55c09aa608c..7b0acaa3d9e 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.71 2014/06/23 18:06:32 maxv Exp $ */
+/* $NetBSD: exec_script.c,v 1.72 2014/06/30 17:22:32 maxv Exp $ */
/*
* Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.71 2014/06/23 18:06:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.72 2014/06/30 17:22:32 maxv Exp $");
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
#define FDSCRIPTS /* Need this for safe set-id scripts. */
@@ -163,12 +163,12 @@ exec_script_makecmds(struct lwp *l, struct exec_package *epp)
for (cp = hdrstr + EXEC_SCRIPT_MAGICLEN; *cp == ' ' || *cp == '\t';
cp++)
;
+ if (*cp == '\0')
+ return ENOEXEC;
/* collect the shell name; remember it's length for later */
shellname = cp;
shellnamelen = 0;
- if (*cp == '\0')
- goto check_shell;
for ( /* cp = cp */ ; *cp != '\0' && *cp != ' ' && *cp != '\t'; cp++)
shellnamelen++;
if (*cp == '\0')