]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1355142 - Implement trick_taint in terms of Taint::Util::untaint()
authorDylan William Hardison <dylan@hardison.net>
Thu, 13 Apr 2017 20:19:44 +0000 (16:19 -0400)
committerDylan William Hardison <dylan@hardison.net>
Tue, 18 Apr 2017 13:52:34 +0000 (09:52 -0400)
Bugzilla/Util.pm
Makefile.PL

index 4371441a043cb155a31f2a01ef578b5ae7b862a3..ca8187c5fdfb9cf473e95ecf49cff2256755c046 100644 (file)
@@ -43,13 +43,12 @@ use Text::Wrap;
 use Encode qw(encode decode resolve_alias);
 use Encode::Guess;
 use POSIX qw(floor ceil);
+use Taint::Util qw(untaint);
 
 sub trick_taint {
-    require Carp;
-    Carp::confess("Undef to trick_taint") unless defined $_[0];
-    my $match = $_[0] =~ /^(.*)$/s;
-    $_[0] = $match ? $1 : undef;
-    return (defined($_[0]));
+    untaint($_[0]);
+
+    return defined $_[0];
 }
 
 sub detaint_natural {
@@ -376,7 +375,7 @@ sub is_ipv6 {
 
     my $ipv6 = join(':', @chunks);
     # The IP address is valid and can now be detainted.
-    trick_taint($ipv6);
+    untaint($ipv6);
 
     # Need to handle the exception of trailing :: being valid.
     return "${ipv6}::" if $ip =~ /::$/;
@@ -655,7 +654,7 @@ sub bz_crypt {
         # HACK: Perl has bug where returned crypted password is considered
         # tainted. See http://rt.perl.org/rt3/Public/Bug/Display.html?id=59998
         unless(tainted($password) || tainted($salt)) {
-            trick_taint($crypted_password);
+            untaint($crypted_password);
         } 
     }
     else {
@@ -697,7 +696,7 @@ sub validate_email_syntax {
         && length($email) <= 127)
     {
         # We assume these checks to suffice to consider the address untainted.
-        trick_taint($_[0]);
+        untaint($_[0]);
         return 1;
     }
     return 0;
index 4499aec1df9b5b8c65727fa6af23031b379b90c7..d3ee9ae890bcc28d2d1ba42bc863a83ea9f04264 100755 (executable)
@@ -61,6 +61,7 @@ my %requires = (
     'Throwable'                => 0,
     'URI'                      => '1.55',
     'version'                  => '0.87',
+    'Taint::Util'              => 0,
 );
 my %build_requires = (
     'ExtUtils::MakeMaker' => '6.57_07',