[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241115173052.GA209502@lichtman.org>
Date: Fri, 15 Nov 2024 17:30:52 +0000
From: Nir Lichtman <nir@...htman.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: brauner@...nel.org, jack@...e.cz, ebiederm@...ssion.com,
kees@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] exec: refactor an invalid executable check to use isprint
On Fri, Nov 15, 2024 at 05:04:47PM +0000, Al Viro wrote:
> On Fri, Nov 15, 2024 at 04:53:51PM +0000, Nir Lichtman wrote:
> > Remove private printable macro that is defined in exec.c and migrate to
> > using the public isprint macro instead
>
>
> > -#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
>
> > - if (printable(bprm->buf[0]) && printable(bprm->buf[1]) &&
> > - printable(bprm->buf[2]) && printable(bprm->buf[3]))
> > + if (isprint(bprm->buf[0]) && isprint(bprm->buf[1]) &&
> > + isprint(bprm->buf[2]) && isprint(bprm->buf[3]))
>
> RTFM(isprint). Or run a trivial loop and check what it does, for that
> matter.
>
> isprint('\t') is false. So's isprint('\n').
Right my bad I read _SP as _S by mistake, I'll send out another version with a fix considering the spaces
Powered by blists - more mailing lists