diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-11-01 13:29:25 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-01 18:45:05 +0100 |
commit | 1aed61964a2b0f7447b1370c97be27774ebcddea (patch) | |
tree | 68e3b396c06d87eb69677ad945f730f0312539c9 /Shell/Tests | |
parent | e87e580eb3b52042d31746a1d3e0a003b21659d5 (diff) | |
download | serenity-1aed61964a2b0f7447b1370c97be27774ebcddea.zip |
Shell: Do not leak the value of ARGV in nested function calls
Diffstat (limited to 'Shell/Tests')
-rw-r--r-- | Shell/Tests/function.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Shell/Tests/function.sh b/Shell/Tests/function.sh index 0dbfad5122..f3ef5aaeed 100644 --- a/Shell/Tests/function.sh +++ b/Shell/Tests/function.sh @@ -24,3 +24,13 @@ if fn 2>/dev/null { fn() { echo $0 } test "$(fn)" = fn || echo '$0' in function not equal to its name && exit 1 + +# Ensure ARGV does not leak from inner frames. +fn() { + fn2 1 2 3 + echo $* +} + +fn2() { } + +test "$(fn foobar)" = "foobar" || echo 'Frames are somehow messed up in nested functions' && exit 1 |