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:
parent
e87e580eb3
commit
1aed61964a
3 changed files with 30 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue