bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ASCII Control Characters as function names


From: Chet Ramey
Subject: Re: ASCII Control Characters as function names
Date: Thu, 02 Jul 2015 14:14:05 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 7/2/15 3:22 AM, Marcus Hildum wrote:

> Bash Version: 4.3
> Patch Level: 33
> Release Status: release
> 
> Description:
>       It is possible to supply many ascii control characters as function
>       names. This allows obfuscation of function calls because the majority of
>       these are non printing characters.
> 
>       
> https://github.com/airencracken/why/blob/master/control_character_functions.sh
> 
> Repeat-By:
>       Define a function with a control character, then call it.
> Fix:
>       Disallow functions to be named after control characters or non-printing
>       characters in general.

I don't view this as a problem.  The namespace for functions is the same as
the namespace for shell scripts and executables.

If you want to restrict this, you can run bash in Posix mode.  One of the
Posix rules bash enforces in this mode is restricting function names to the
valid shell identifier namespace.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]