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

List:       bash-bug
Subject:    Re: Stumped on a question of scoping and unset.
From:       Andreas Schwab <schwab () linux-m68k ! org>
Date:       2011-05-26 15:40:40
Message-ID: m262oxh3lz.fsf () igel ! home
[Download RAW message or body]

Freddy Vulto <fvulto@gmail.com> writes:

> On 09:11, Steven W. Orr wrote:
>> typeset $1 && upvars -a$nn $1 "${aval[@]}"
>> 
>> The implication seems to be that the typeset command can fail. Is
>> this a reasonable thing to worry about?
>
> The idea is that a typeset - besides declaring a variable local -
> protects upvars from malicious variable names:
>
>     $ typeset 'ls -l'
>     bash: typeset: `ls -l': not a valid identifier
>     $ echo $?
>     1

Unfortunately, that is subverted by the unquoted use of $1 above.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

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