diff options
Diffstat (limited to 'fs/binfmt_script.c')
-rw-r--r-- | fs/binfmt_script.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index d0078cbb718b..7cde3f46ad26 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c | |||
@@ -42,14 +42,10 @@ static int load_script(struct linux_binprm *bprm) | |||
42 | fput(bprm->file); | 42 | fput(bprm->file); |
43 | bprm->file = NULL; | 43 | bprm->file = NULL; |
44 | 44 | ||
45 | for (cp = bprm->buf+2;; cp++) { | 45 | bprm->buf[BINPRM_BUF_SIZE - 1] = '\0'; |
46 | if (cp >= bprm->buf + BINPRM_BUF_SIZE) | 46 | if ((cp = strchr(bprm->buf, '\n')) == NULL) |
47 | return -ENOEXEC; | 47 | cp = bprm->buf+BINPRM_BUF_SIZE-1; |
48 | if (!*cp || (*cp == '\n')) | ||
49 | break; | ||
50 | } | ||
51 | *cp = '\0'; | 48 | *cp = '\0'; |
52 | |||
53 | while (cp > bprm->buf) { | 49 | while (cp > bprm->buf) { |
54 | cp--; | 50 | cp--; |
55 | if ((*cp == ' ') || (*cp == '\t')) | 51 | if ((*cp == ' ') || (*cp == '\t')) |