From 063af8ae790e4e67087aa1ed51aceae1a3b77be0 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 25 Jun 2016 21:28:32 +0200 Subject: wibble --- pullimap | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pullimap b/pullimap index 18572e6..d176464 100755 --- a/pullimap +++ b/pullimap @@ -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 = ''; } -- cgit v1.2.3