Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14449 > unrolled thread

Re: bash brace issues (similar to shellshock)

Started byChet Ramey <chet.ramey@case.edu>
First post2018-08-06 12:22 -0400
Last post2018-08-06 12:22 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: bash brace issues (similar to shellshock) Chet Ramey <chet.ramey@case.edu> - 2018-08-06 12:22 -0400

#14449 — Re: bash brace issues (similar to shellshock)

FromChet Ramey <chet.ramey@case.edu>
Date2018-08-06 12:22 -0400
SubjectRe: bash brace issues (similar to shellshock)
Message-ID<mailman.4757.1533572555.1292.bug-bash@gnu.org>
On 8/6/18 12:13 PM, Pierre Gaston wrote:
> On Mon, Aug 6, 2018 at 4:32 PM, martins dada <martinsdada03@gmail.com>
> wrote:
> 
>> Find attached details regarding bash brace issues. King regards.
>>
> 
> you are simply assigning (){ to a temporary environment before running the
> command
> 
> $  n=(){ bash -c 'echo $n'
> (){
> 
> just like:
> 
> a=foo bash -c 'echo $a'
> 
> I'd agree that I would not expect bash to accept this without quotes,
> but it does not allow to execute arbitrary commands like shellshock did.
> At least your examples don't show this.

Since bash parses the assignment as a possible compound array assignment,
it accepts the parens and doesn't throw an error. Once it discovers that
the statement doesn't qualify as a compound assignment, it has a choice:
it can go back and throw an error, or accept the assignment as if it were
quoted. It does the latter.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web