Subject: | path to make GD::SecurityImage::AC taint-safe(r) |
When running with taint checking enabled, GD::SecurityImage::AC is
killed when attempting to unlink old image files in sub _unlink() line 99.
changing the body of the subroutine to this will allow it to pass taint
checking:
sub _unlink {
my $file = shift or return;
if (-e $file && !-d _)
{
if ($file =~ /(^[\w\+_\040\#\(\)\{\}\[\]\/\-\^,\.:;&%@\\~]+\$?$)/ )
{
$file = $1;
return unlink($file);
}
else
{
die "Filename $file unsafe to unlink";
}
}
return 1; # resume on unexistent file
}
Perhaps a better RE could be used to check the filename. I stole the one
in here from CGI::Untaint::Filename.
Thanks!
Devin