diff options
-rwxr-xr-x | pullimap | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -277,14 +277,13 @@ sub pull_callback($$) { my $uid = $mail->{UID}; my $from = first { defined $_ and @$_ } @{$mail->{ENVELOPE}}[2,3,4]; if (defined $from and @$from) { - my ($l, $d) = ($from->[0]->[2], $from->[0]->[3]); - if ($l !~ qr/\A$RE_ATOM(?:\.$RE_ATOM)*\z/o) { # Dot-string, RFC 5321 - # quote the local part - $IMAP->panic("Invalid MAIL FROM: <$l\@$d>") unless $l =~ qr/\A[\x20-\x7E]*\z/; + my ($l, $d) = @{$from->[0]}[2,3]; + unless ($l =~ /\A$RE_ATOM(?:\.$RE_ATOM)*\z/o) { # quote the local part if not Dot-string (RFC 5321) $l =~ s/([\x22\x5C])/\\$1/g; # escape double-quote and backslash $l = '"' .$l. '"'; } $from = $l .'@'. $d; + $IMAP->fail("Invalid character in MAIL FROM: <$from>") unless $l =~ /\A[\x20-\x7E]*\z/; } else { $from = ''; } |