|
|
@@ -42,14 +42,10 @@ static int load_script(struct linux_binprm *bprm)
|
|
|
fput(bprm->file);
|
|
|
bprm->file = NULL;
|
|
|
|
|
|
- for (cp = bprm->buf+2;; cp++) {
|
|
|
- if (cp >= bprm->buf + BINPRM_BUF_SIZE)
|
|
|
- return -ENOEXEC;
|
|
|
- if (!*cp || (*cp == '\n'))
|
|
|
- break;
|
|
|
- }
|
|
|
+ bprm->buf[BINPRM_BUF_SIZE - 1] = '\0';
|
|
|
+ if ((cp = strchr(bprm->buf, '\n')) == NULL)
|
|
|
+ cp = bprm->buf+BINPRM_BUF_SIZE-1;
|
|
|
*cp = '\0';
|
|
|
-
|
|
|
while (cp > bprm->buf) {
|
|
|
cp--;
|
|
|
if ((*cp == ' ') || (*cp == '\t'))
|