Commit de027530 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 297928: detaint_natural, detaint_signed and trick_taint shouldn't rely on $1…

Bug 297928: detaint_natural, detaint_signed and trick_taint shouldn't rely on $1 - Patch by Christian Reis <kiko@async.com.br> r/a = justdave
parent 1fde2120
...@@ -59,20 +59,20 @@ sub is_tainted { ...@@ -59,20 +59,20 @@ sub is_tainted {
sub trick_taint { sub trick_taint {
require Carp; require Carp;
Carp::confess("Undef to trick_taint") unless defined $_[0]; Carp::confess("Undef to trick_taint") unless defined $_[0];
$_[0] =~ /^(.*)$/s; my ($match) = $_[0] =~ /^(.*)$/s;
$_[0] = $1; $_[0] = $match;
return (defined($_[0])); return (defined($_[0]));
} }
sub detaint_natural { sub detaint_natural {
$_[0] =~ /^(\d+)$/; my ($match) = $_[0] =~ /^(\d+)$/;
$_[0] = $1; $_[0] = $match;
return (defined($_[0])); return (defined($_[0]));
} }
sub detaint_signed { sub detaint_signed {
$_[0] =~ /^([-+]?\d+)$/; my ($match) = $_[0] =~ /^([-+]?\d+)$/;
$_[0] = $1; $_[0] = $match;
# Remove any leading plus sign. # Remove any leading plus sign.
if (defined($_[0]) && $_[0] =~ /^\+(\d+)$/) { if (defined($_[0]) && $_[0] =~ /^\+(\d+)$/) {
$_[0] = $1; $_[0] = $1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment