[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Shell test or quoting mechanism breaks on parens
From:       Rich Felker <dalias () libc ! org>
Date:       2014-05-20 2:10:00
Message-ID: 20140520021000.GW507 () brightrain ! aerifal ! cx
[Download RAW message or body]

On Mon, May 19, 2014 at 05:02:48PM -0500, Dung_Nguyen@Dell.com wrote:
> Dell - Internal Use - Confidential
> Hello,
> I used to use busybox 1.00 and this command line returns 0 or at least the output \
> is the same as RHEL 5.3 shell: 
> # [ '(' = '(' ] ; rc=$? ; echo $rc ; [ $rc -ne 0 ] && echo EVIL SH TEST/QUOTE
> 0
> 
> However, after I upgraded to busybox 1.20.2 and I see different output:
> 
> # [ '(' = '(' ] ; rc=$? ; echo $rc ; [ $rc -ne 0 ] && echo EVIL SH TEST/QUOTE
> sh: closing paren expected
> 2
> EVIL SH TEST/QUOTE
> 
> Does anyone know why the output is different with busybox 1.00 or is this a \
> security issue from cmd line ?

As far as I can tell the issue is in the test command (both standalone
and in the shell), not in the shell itself. The standard test/[
command has very specific rules for how its arguments are interpreted
and Busybox does not seem to be honoring them. See:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

In particular, if there are 3 arguments and the second is a binary
primary (which '=' is) then, regardless of the contents of the first
and third, the binary primary is applied to them.

Hopefully someone familiar with the Busybox source can look into this.

Rich
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic