diff options
author | Richard Levitte <levitte@openssl.org> | 2015-09-03 19:41:40 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-09-07 16:10:58 +0200 |
commit | e3ff089249a31765c23faaf9d8019b7889dd0c58 (patch) | |
tree | d69da1bf30034eed3a2b621fcdf4dbb5ec948f7b /test | |
parent | 5beb63c41e8bc140cd8096af8195b0b95bef1ff5 (diff) |
Small fix in OpenSSL::Test
Be careful when shifting in a function argument, you end up changing
the caller's value. Instead, when it is an array, make a shallow copy
and shift in that instead.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/testlib/OpenSSL/Test.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/testlib/OpenSSL/Test.pm b/test/testlib/OpenSSL/Test.pm index 83d7acc8b7..f378351f65 100644 --- a/test/testlib/OpenSSL/Test.pm +++ b/test/testlib/OpenSSL/Test.pm @@ -695,8 +695,10 @@ sub __build_cmd { my $num = shift; my $path_builder = shift; - my $cmd = __fixup_cmd($path_builder->(shift @{$_[0]})); - my @args = @{$_[0]}; shift; + # Make a copy to not destroy the caller's array + my @cmdarray = ( @{$_[0]} ); shift; + my $cmd = __fixup_cmd($path_builder->(shift @cmdarray)); + my @args = @cmdarray; my %opts = @_; return () if !$cmd; |