This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Limit index arg to logicals in vmstrnenv().
authorCraig A. Berry <craigberry@mac.com>
Tue, 26 Jan 2016 02:19:55 +0000 (20:19 -0600)
committerCraig A. Berry <craigberry@mac.com>
Tue, 26 Jan 2016 02:19:55 +0000 (20:19 -0600)
commit2364b895f557fc4e1fa854fe5757353d62d195f9
treea86a276bbfed8aec2793f01a39f04e0d9cd33de6
parentef18391745841fb1df298cec3a3001be4237fb3d
Limit index arg to logicals in vmstrnenv().

vmstrnenv looks in the environ array, the DCL symbol table, and/or
the logical names pointed to by LNM$FILE_DEV, depending on the
setting of PERL_ENV_TABLES.  Its index parameter, however, only
makes sense with logical names, and when returning one element of
a search list logical. So return 0 indicating a failed lookup when
passed a non-zero index and what we found is not a logical name.

Without this, the natural idiom of iterating over index values to
get the elements of a search list could get us stuck in an endless
loop if the item we are looking for does exist but is not a
logical name.
vms/vms.c