author: Kirill A. Shutemov <kirill@shutemov.name> 2008-10-15 22:02:39 -0700
committer: Linus Torvalds <torvalds@linux-foundation.org> 2008-10-16 11:21:38 -0700
commit: bf2a9a39639b8b51377905397a5005f444e9a892
parent: 53112488bebe25c0f5f8a002470046c0fe9a6c61
Commit Summary:
Diffstat:
1 file changed, 3 insertions, 2 deletions
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index 9e3963f7ebf1..08343505e184 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -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 = 1;
+ bprm->recursion_depth++;
allow_write_access(bprm->file);
fput(bprm->file);
bprm->file = NULL;