Merge 4.14.101 into android-4.14 Changes in 4.14.101 Revert "exec: load_script: don't blindly truncate shebang string" Linux 4.14.101 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
diff --git a/Makefile b/Makefile index d666899..eddd513 100644 --- a/Makefile +++ b/Makefile
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 -SUBLEVEL = 100 +SUBLEVEL = 101 EXTRAVERSION = NAME = Petit Gorille
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index d0078cb..7cde3f46 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c
@@ -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'))