[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241115170447.GX3387508@ZenIV>
Date: Fri, 15 Nov 2024 17:04:47 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Nir Lichtman <nir@...htman.org>
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 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').
Powered by blists - more mailing lists