Subject: | Cache broken in taint mode |
Broken in taint mode with cache. Problem is that attempting to unlink
an expired cache file fails.
Insecure dependency in unlink while running with -T switch
at /usr/lib/perl5/site_perl/5.8.8/Net/Whois/Raw/Common.pm line 25.
Quick fix is:
# get whois from cache
sub get_from_cache {
my ($query, $cache_dir, $cache_time) = @_;
return undef unless $cache_dir;
mkdir $cache_dir unless -d $cache_dir;
my $now = time;
# clear the cache
foreach ( glob("$cache_dir/*") ) {
my $mtime = ( stat($_) )[9] or next;
my $elapsed = $now - $mtime;
#TL - replace 1 line with 5
# unlink $_ if ( $elapsed / 60 >= $cache_time );
$_ =~ m/^(.*)$/;
my $fn = $1;
$elapsed =~ m/^(.*)$/;
$elapsed = $1;
unlink $fn if ( $elapsed / 60 >= $cache_time );
##
}
Net-Whois-Raw V 2.00; Perl 5.8.8; Fedora 6