Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern If the interpreter is "", do not keep loading the s...



details:   https://anonhg.NetBSD.org/src/rev/b55c7355c569
branches:  trunk
changeset: 796995:b55c7355c569
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Jun 30 17:22:32 2014 +0000

description:
If the interpreter is "", do not keep loading the script (which will later
fail), but return ENOEXEC directly.

ok christos@

diffstat:

 sys/kern/exec_script.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 3c6a4c84be7e -r b55c7355c569 sys/kern/exec_script.c
--- a/sys/kern/exec_script.c    Mon Jun 30 17:02:55 2014 +0000
+++ b/sys/kern/exec_script.c    Mon Jun 30 17:22:32 2014 +0000
@@ -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 @@
        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')



Home | Main Index | Thread Index | Old Index