Skip to content

Commit f659036

Browse files
committed
Don't use $1 blindly in File::Temp->tempdir
On VMS only there is some very old code that has been making blind use of $1 without knowing if the match succeeded. If $1 happens to be empty when the match fails, no harm is done, but if it has a value in it whose length is longer than the position of the final 'X' in the template pattern, _gettemp ends up with a negative offset and things go off the rails. ext/File-Find/t/taint.t has been failing in core because of this. Fixed upstream: Perl-Toolchain-Gang/File-Temp@d640d0d
1 parent 35701a7 commit f659036

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Porting/Maintainers.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,9 @@ package Maintainers;
558558
qr[^t/00-report-prereqs],
559559
qr{^xt},
560560
],
561+
'CUSTOMIZED' => [
562+
qw( lib/File/Temp.pm )
563+
],
561564
},
562565

563566
'Filter::Simple' => {

cpan/File-Temp/lib/File/Temp.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package File::Temp; # git description: v0.2310-3-gc7148fe
22
# ABSTRACT: return name and handle of a temporary file safely
33

4-
our $VERSION = '0.2311';
4+
our $VERSION = '0.2311_01';
55

66
#pod =begin :__INTERNALS
77
#pod
@@ -1706,8 +1706,8 @@ sub tempdir {
17061706
# Create the directory
17071707
my $tempdir;
17081708
my $suffixlen = 0;
1709-
if ($^O eq 'VMS') { # dir names can end in delimiters
1710-
$template =~ m/([\.\]:>]+)$/;
1709+
if ($^O eq 'VMS'
1710+
&& ($template =~ m/([\.\]:>]+)$/)) { # dir specs can end in delimiters
17111711
$suffixlen = length($1);
17121712
}
17131713
if ( ($^O eq 'MacOS') && (substr($template, -1) eq ':') ) {

t/porting/customized.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
AutoLoader cpan/AutoLoader/t/02AutoSplit.t bb90cda13b88599ad45de4b45799d5218afcb6d8
55
ExtUtils::Constant cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm 7560e1018f806db5689dee78728ccb8374aea741
66
ExtUtils::Constant cpan/ExtUtils-Constant/t/Constant.t 165e9c7132b003fd192d32a737b0f51f9ba4999e
7+
File::Temp cpan/File-Temp/lib/File/Temp.pm d55be6139dbc5d821ad5d55141f35c608b06db75
78
Filter::Util::Call pod/perlfilter.pod d1e217d0bc6083755b9017050b8724472c58275a
89
Locale::Maketext::Simple cpan/Locale-Maketext-Simple/lib/Locale/Maketext/Simple.pm 57ed38905791a17c150210cd6f42ead22a7707b6
910
MIME::Base64 cpan/MIME-Base64/Base64.xs ad617fe2d01932c35b92defa26d40aba601a95a8

0 commit comments

Comments
 (0)