From: Linus Torvalds <torvalds@linux-foundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
Samuel Dionne-Riel <samuel@dionne-riel.com>,
Richard Weinberger <richard.weinberger@gmail.com>,
Graham Christensen <graham@grahamc.com>,
Michal Hocko <mhocko@suse.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] exec: load_script: Do not exec truncated interpreter path
Date: Sun, 17 Feb 2019 09:30:17 -0800 [thread overview]
Message-ID: <CAHk-=wiA00pLq_3DautqfL=Dn9r4Nmjgw+M2ABt-RfCX38xh6g@mail.gmail.com> (raw)
In-Reply-To: <20190217090903.GA17600@beast>
On Sun, Feb 17, 2019 at 1:09 AM Kees Cook <keescook@chromium.org> wrote:
>
> +static inline char *next_spacetab(char *first, const char *last)
> +{
> + for (; first <= last; first++)
> + if (spacetab(*first))
> + return first;
> + return NULL;
> +}
I think this should be "next_terminator()" and also stop at NUL.
You do check for the NUL case here:
> + if (!next_spacetab(cp, buf_end) && *buf_end)
> + return -ENOEXEC;
but it means that if there's no space ot tab and it's a short file,
you pointlessly walk to the end. No?
Linus
next prev parent reply other threads:[~2019-02-17 17:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-17 9:09 [PATCH v4] exec: load_script: Do not exec truncated interpreter path Kees Cook
2019-02-17 17:30 ` Linus Torvalds [this message]
2019-02-17 17:41 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHk-=wiA00pLq_3DautqfL=Dn9r4Nmjgw+M2ABt-RfCX38xh6g@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=graham@grahamc.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=oleg@redhat.com \
--cc=richard.weinberger@gmail.com \
--cc=samuel@dionne-riel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).