mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nir Lichtman <nir@lichtman.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: brauner@kernel.org, jack@suse.cz, ebiederm@xmission.com,
	kees@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exec: refactor an invalid executable check to use isprint
Date: Fri, 15 Nov 2024 17:30:52 +0000	[thread overview]
Message-ID: <20241115173052.GA209502@lichtman.org> (raw)
In-Reply-To: <20241115170447.GX3387508@ZenIV>

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

      reply	other threads:[~2024-11-15 17:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 16:53 Nir Lichtman
2024-11-15 17:04 ` Al Viro
2024-11-15 17:30   ` Nir Lichtman [this message]

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=20241115173052.GA209502@lichtman.org \
    --to=nir@lichtman.org \
    --cc=brauner@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=jack@suse.cz \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®