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>] [day] [month] [year] [list]
Date:	Thu, 17 Feb 2011 12:04:19 -0800
From:	Andrew Farmer <andrew.farmer@...amhost.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH/RFC] Treat CR like NL in script interpreter line

Command-line or CGI scripts with CR+LF line ending end up confusing
binfmt_script. This typically ends up making the scripts fail to run with
inexplicable error messages (like "no such file or directory"). While it'd
certainly be ideal to just tell users to use sensible text editors, making
their scripts just work as intended is nice too.

When a similar patch was proposed in 2001, the issue was raised that it would
prevent the operation of a script using the "perl\r" interpreter, for instance.
However, not only is this a very silly interpreter name, but it's also already
impossible to use an interpreter with a tab, space, or newline in its name, and
I don't believe anyone's complained about those inabilities!

---
 fs/binfmt_script.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index 396a988..b19c001 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -36,7 +36,7 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
        bprm->file = NULL;
 
        bprm->buf[BINPRM_BUF_SIZE - 1] = '\0';
-       if ((cp = strchr(bprm->buf, '\n')) == NULL)
+       if ((cp = strpbrk(bprm->buf, "\n\r")) == NULL)
                cp = bprm->buf+BINPRM_BUF_SIZE-1;
        *cp = '\0';
        while (cp > bprm->buf) {
-- 
1.7.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ