Subject: | Mail::Internet chokes on "-:" in mail header |
I got a spam with a "-:" header line today. This makes Mail::Internet
croak. Script to reproduce the bug:
# perl
use Mail::Internet;
Mail::Internet->new(["-:"]);
^D
Bad RFC822 field name ''
at /usr/local/share/perl/5.6.1/Mail/Internet.pm line 130
#
This happens with MailTools 1.62, perl 5.6.1 under Debian stable.
AFAICS, the Croak happens in Mail::Header's _tag_case, where
tag is reconstructed as
join('-',
map { /^[b-df-hj-np-tv-z]+$|^(?:MIME|SWE|SOAP|LDAP)$/i
? uc($_) : ucfirst(lc($_)) }
split('-', $tag));
The split on "-" gives an empty list, so nothing remains.
I solved it on my box by adding
return $tag if $tag =~ /^-+$/;
before the reformat, but I bet you can do it more elegantly :-)
- Torsten