summary refs log tree commit diff
path: root/bin/1sh/libedit
ModeNameSize
-rw-r--r--.gitignore67log plain blame
-rw-r--r--Makefile1043log plain blame
-rw-r--r--chared.c170572012-02-25 15:35:18 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2012-02-25 15:35:18 +0800
commit46d3c1a614f11f0d40a7e73376359618ff07abcd (patch)
tree889c7ccdf81c2559c784158333664fa14217b344 /src/builtins.def.in
parent[SHELL] Add top-level autogen.sh (diff)
downloaddash-46d3c1a614f11f0d40a7e73376359618ff07abcd.tar.gz
dash-46d3c1a614f11f0d40a7e73376359618ff07abcd.zip
[VAR] Sanitise environment variable names on entry
On Tue, Feb 14, 2012 at 10:48:48AM +0000, harald@redhat.com wrote:
> 
> "export -p" prints all environment variables, without checking if the
> environment variable is a valid dash variable name.
> 
> IMHO, the only valid usecase for "export -p" is to eval the output.
> 
> $ eval $(export -p); echo OK
> OK
> 
> Without this patch the following test does error out with:
> 
> test.py:
> import os
> os.environ["test-test"]="test"
> os.environ["test_test"]="test"
> os.execv("./dash", [ './dash', '-c', 'eval $(export -p); echo OK' ])
> 
> $ python test.py
> ./dash: 1: export: test-test: bad variable name
> 
> Of course the results can be more evil, if the environment variable
> name is crafted, that it injects valid shell code.

This patch fixes the issue by sanitising all environment variable names
upon entry into the shell.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/builtins.def.in')
0 files changed, 0 insertions, 0 deletions
r--r--editline.323969log plain blame -rw-r--r--editline.733733log plain blame -rw-r--r--editrc.57068log plain blame -rw-r--r--el.c12352log plain blame -rw-r--r--el.h5278log plain blame -rw-r--r--eln.c8586log plain blame -rw-r--r--emacs.c12549log plain blame -rw-r--r--filecomplete.c15343log plain blame -rw-r--r--filecomplete.h2027log plain blame -rw-r--r--hist.c6441log plain blame -rw-r--r--hist.h3454log plain blame -rw-r--r--histedit.h9382log plain blame -rw-r--r--history.c28919log plain blame -rw-r--r--historyn.c60log plain blame -rw-r--r--keymacro.c16794log plain blame -rw-r--r--keymacro.h3222log plain blame -rw-r--r--literal.c3707log plain blame -rw-r--r--literal.h2147log plain blame -rw-r--r--makelist4556log plain blame -rw-r--r--map.c42839log plain blame -rw-r--r--map.h3317log plain blame -rw-r--r--parse.c6193log plain blame -rw-r--r--parse.h2162log plain blame -rw-r--r--prompt.c4775log plain blame -rw-r--r--prompt.h2499log plain blame -rw-r--r--read.c14058log plain blame -rw-r--r--read.h1990log plain blame -rw-r--r--readline.c48624log plain blame d---------readline74log plain -rw-r--r--refresh.c33142log plain blame -rw-r--r--refresh.h2507log plain blame -rw-r--r--search.c15642log plain blame -rw-r--r--search.h2855log plain blame -rw-r--r--shlib_version150log plain blame -rw-r--r--sig.c5231log plain blame -rw-r--r--sig.h2490log plain blame -rw-r--r--sys.h3504log plain blame -rw-r--r--terminal.c41969log plain blame -rw-r--r--terminal.h5291log plain blame -rw-r--r--tokenizer.c10359log plain blame -rw-r--r--tokenizern.c62log plain blame -rw-r--r--tty.c30640log plain blame -rw-r--r--tty.h11257log plain blame -rw-r--r--vi.c25395log plain blame