Skip Menu |

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 7207
Status: resolved
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: t.luettgert [...] combox.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.62
Fixed in: (no value)



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
Show quoted text
> 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 =~ /^-+$/;
The problem you see is correct, but the solution only partial... What about A- ? The simple solution is adding -1 to split split /\-/, $tag, -1 Thanks for the report. Same fix applied to Mail::Message::Field::wellformedName()