]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/binfmt_script.c
Allow recursion in binfmt_script and binfmt_misc
[net-next-2.6.git] / fs / binfmt_script.c
index 4d0e0f6d3273df654ae2156b0c28cc9f58a8ac57..08343505e18455dedebace59a8c489ecb3b1cf7a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  linux/fs/binfmt_script.c
  *
- *  Copyright (C) 1996  Martin von Lwis
+ *  Copyright (C) 1996  Martin von Lรถwis
  *  original #!-checking implemented by tytso.
  */
 
@@ -22,14 +22,15 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
        char interp[BINPRM_BUF_SIZE];
        int retval;
 
-       if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || (bprm->sh_bang)) 
+       if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') ||
+           (bprm->recursion_depth > BINPRM_MAX_RECURSION))
                return -ENOEXEC;
        /*
         * This section does the #! interpretation.
         * Sorta complicated, but hopefully it will work.  -TYT
         */
 
-       bprm->sh_bang++;
+       bprm->recursion_depth++;
        allow_write_access(bprm->file);
        fput(bprm->file);
        bprm->file = NULL;