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: Stephane Chazelas
Subject: Re: ASCII Control Characters as function names
Date: Thu, 2 Jul 2015 14:54:11 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2015-07-02 00:22:08 -0700, Marcus Hildum:
[...]
> 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.
[...]

(note that I am not a bash developer, this opinion is just mine)

Files (so commands on the file system) can have any character in
their name, functions share the same name space as other
commands (files), so I don't see the point in restricting one
and not the other.

If one wants to obfuscate his scripts, who are we to stop him
doing that, on what ground?

Note that zsh allows any string as a function name including
things that can't be file paths like the empty string or strings
containing NUL bytes:

$ ''() echo test
$ ''
test
$ $'\0'() echo foo
$ $'\0'
foo

-- 
Stephane




reply via email to

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