Subject: | Mail::DKIM::PrivateKey->load tampering $_ and <FILE> |
In Mail/DKIM/PrivateKey.pm's sub load:
open FILE, "<", $prms{'File'}
or die "Error: cannot read $prms{File}: $!\n";
while (<FILE>) {
These lines cause two problems:
1. Anybody else (CPAN module or the users source) using FILE as named file handle will get into trouble. Using named fhs isn't good behavior, but even worse when done by CPAN modules. FILE should be replaced by $key_file or $key_fh, preferably as open my $key_fh,...
2. while (<FILE>) reverse-tampers $_ if the load function is called within a loop without own loop variable (e.g. for (@keys) { Mail::DKIM::PrivateKey->load(File => $_ }). It's also a problem of the calling source, but you could avoid problems by using while (my $line = <FILE>) { instead.