This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Can't do require Foo if $tainted; because taint tunnels.
authorNicholas Clark <nick@ccl4.org>
Sat, 13 May 2006 10:36:18 +0000 (10:36 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 13 May 2006 10:36:18 +0000 (10:36 +0000)
(Documented, but I regard this as a serious practical deficiency in
tainting)

p4raw-id: //depot/perl@28185

lib/Tie/RefHash.pm

index 30a90d9..2f09628 100644 (file)
@@ -2,7 +2,7 @@ package Tie::RefHash;
 
 use vars qw/$VERSION/;
 
 
 use vars qw/$VERSION/;
 
-$VERSION = "1.34";
+$VERSION = "1.34_01";
 
 =head1 NAME
 
 
 =head1 NAME
 
@@ -96,7 +96,12 @@ BEGIN {
   use Config ();
   my $usethreads = $Config::Config{usethreads}; # && exists $INC{"threads.pm"}
   *_HAS_THREADS = $usethreads ? sub () { 1 } : sub () { 0 };
   use Config ();
   my $usethreads = $Config::Config{usethreads}; # && exists $INC{"threads.pm"}
   *_HAS_THREADS = $usethreads ? sub () { 1 } : sub () { 0 };
-  require Scalar::Util if $usethreads; # we need weaken()
+  if ($usethreads) {
+    # The magic of taint tunneling means that we can't do this require in the
+    # same statement as the boolean check on $usethreads, as $usethreads is
+    # tainted.
+    require Scalar::Util;
+  }
 }
 
 BEGIN {
 }
 
 BEGIN {