This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove duplicate environment variables from environ
authorTony Cook <tony@develop-help.com>
Wed, 27 Jan 2016 00:52:15 +0000 (11:52 +1100)
committerRicardo Signes <rjbs@cpan.org>
Tue, 1 Mar 2016 12:17:38 +0000 (23:17 +1100)
commitae37b791a73a9e78dedb89fb2429d2628cf58076
treeab3ce57bd2a480fb934343c296987114578c66c5
parent4fc434514b68fb79f32adde95ac1589418263249
remove duplicate environment variables from environ

If we see duplicate environment variables while iterating over
environ[]:

a) make sure we use the same value in %ENV that getenv() returns.

Previously on a duplicate, %ENV would have the last entry for the name
from environ[], but a typical getenv() would return the first entry.

Rather than assuming all getenv() implementations return the first entry
explicitly call getenv() to ensure they agree.

b) remove duplicate entries from environ

Previously if there was a duplicate definition for a name in environ[]
setting that name in %ENV could result in an unsafe value being passed
to a child process, so ensure environ[] has no duplicates.

CVE-2016-2381
perl.c