1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 09:27:35 +00:00

Shell: Do not leak the value of ARGV in nested function calls

This commit is contained in:
AnotherTest 2020-11-01 13:29:25 +03:30 committed by Andreas Kling
parent e87e580eb3
commit 1aed61964a
3 changed files with 30 additions and 11 deletions

View file

@ -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