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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Sep 2017 19:28:56 +0200
From:   Michal Suchánek <msuchanek@...e.de>
To:     Al Viro <viro@...IV.linux.org.uk>
Cc:     Tamara Diaconita <diaconitatamara@...il.com>,
        Baoquan He <bhe@...hat.com>,
        Kamlakant Patel <kamlakant.patel@...adcom.com>,
        Jonathan Corbet <corbet@....net>,
        Jani Nikula <jani.nikula@...el.com>,
        Trond Myklebust <trond.myklebust@...marydata.com>,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nicholas Piggin <npiggin@...il.com>,
        Ingo Molnar <mingo@...nel.org>,
        Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
        Ilya Matveychikov <matvejchikov@...il.com>,
        Paul Mackerras <paulus@...ba.org>,
        Hari Bathini <hbathini@...ux.vnet.ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linuxppc-dev@...ts.ozlabs.org,
        Bamvor Jian Zhang <bamvor.zhangjian@...aro.org>
Subject: Re: [PATCH 1/6] lib/cmdline.c: Add backslash support to kernel
 commandline parsing.

On Fri, 15 Sep 2017 18:14:09 +0100
Al Viro <viro@...IV.linux.org.uk> wrote:

> On Fri, Sep 15, 2017 at 07:02:46PM +0200, Michal Suchanek wrote:
> 
> >  	for (i = 0; args[i]; i++) {
> > -		if (isspace(args[i]) && !in_quote)
> > +		if (isspace(args[i]) && !in_quote && !backslash)
> >  			break;
> > -		if (equals == 0) {
> > -			if (args[i] == '=')
> > -				equals = i;
> > +
> > +		if ((equals == 0) && (args[i] == '='))
> > +			equals = i;
> > +
> > +		if (!backslash) {
> > +			if ((args[i] == '"') || (args[i] == '\\'))
> > {
> > +				if (args[i] == '"')
> > +					in_quote = !in_quote;
> > +				if (args[i] == '\\')
> > +					backslash = 1;
> > +
> > +				memmove(args + 1, args, i);
> > +				args++;
> > +				i--;
> > +			}
> > +		} else {
> > +			backslash = 0;
> >  		}
> > -		if (args[i] == '"')
> > -			in_quote = !in_quote;
> >  	}  
> 
> ... and that makes for Unidiomatic Work With Strings Award for this
> September. Using memmove() for string rewrite is almost always bad
> taste; in this case it's also (as usual) broken.

Care to share how it is broken?

Thanks

Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ