lkml.org 
[lkml]   [2019]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4] exec: load_script: Do not exec truncated interpreter path
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

\
 
 \ /
  Last update: 2019-02-17 18:31    [W:0.030 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site