I am in need of thy help!
I have just activated the -T switch in all my scripts and everything went smoothly untill I run into the "unlink" command. He seems not to accept my untainting regexp, complaining "Insecure dependency in unlink while running with -T switch...". Here goes my code:
Here´s the untaint() function, wich is 'require'd from another .cgi:my $subcookie = untaint ( substr($cookie,0,6) ); # this is a substring + of the SID, that I use as a name for a dinamic directory for the use +r. Also, check my untaint() function below opendir (DIR, "../users/$subcookie/"); # I was using glob, but couldn´ +t make -T accept it, so I changed to readdir my @files = readdir DIR; foreach my $file (@files) { my $checked_file; if ( $file =~ /(\w+)\.(\w{3,4})/ ) { $checked_file = "$1.$2"; } # a +voiding the first "." and ".." thar readdir returns if ( defined $checked_file ) { unlink "../users/$subcookie/$checked +_file"; } } close DIR; ... # and the code goes on
Anyone knows what might be? Is there a less demanding function I can use to wipe out all the files in this directory?sub untaint { my $string = shift; my $clean_string; if ( $string =~ /([\w\-\_]+)/ ) { $clean_string = $1; } else { die "ilegal character: $!"; } return $clean_string; }
Thanks a lot, my friends!
André
In reply to Unlink under taint mode by Andre_br
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |