lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241115165351.GA209124@lichtman.org>
Date: Fri, 15 Nov 2024 16:53:51 +0000
From: Nir Lichtman <nir@...htman.org>
To: viro@...iv.linux.org.uk, brauner@...nel.org, jack@...e.cz,
	ebiederm@...ssion.com, kees@...nel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] exec: refactor an invalid executable check to use isprint

Remove private printable macro that is defined in exec.c and migrate to
using the public isprint macro instead

Signed-off-by: Nir Lichtman <nir@...htman.org>
---
 fs/exec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 6c53920795c2..3394de5882af 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1723,7 +1723,6 @@ int remove_arg_zero(struct linux_binprm *bprm)
 }
 EXPORT_SYMBOL(remove_arg_zero);
 
-#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
 /*
  * cycle the list of binary formats handler, until one recognizes the image
  */
@@ -1761,8 +1760,8 @@ static int search_binary_handler(struct linux_binprm *bprm)
 	read_unlock(&binfmt_lock);
 
 	if (need_retry) {
-		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]))
 			return retval;
 		if (request_module("binfmt-%04x", *(ushort *)(bprm->buf + 2)) < 0)
 			return retval;
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ