]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mda: use PublicInbox::Address to extract emails
authorEric Wong <e@yhbt.net>
Fri, 19 Jun 2020 17:18:47 +0000 (17:18 +0000)
committerEric Wong <e@yhbt.net>
Tue, 7 Jul 2020 06:04:45 +0000 (06:04 +0000)
I'm not sure why this wasn't done in Jun/July 2016 when I was
working on PublicInbox::Address to replace the DoS-vulnerable
Email::Address.

Nowadays, PublicInbox::Address allows using Email::Address::XS
which should be fast and robust.

lib/PublicInbox/MDA.pm

index 57b436b984e354c19550697d3eb766ac519a97e9..fa4a2ad85929a01b3f680e7b4ca278654b98b8f0 100644 (file)
@@ -6,6 +6,7 @@ package PublicInbox::MDA;
 use strict;
 use warnings;
 use PublicInbox::MsgTime;
+use PublicInbox::Address;
 use constant MAX_SIZE => 1024 * 500; # same as spamc default, should be tunable
 use constant MAX_MID_SIZE => 244; # max term size - 1 in Xapian
 
@@ -62,7 +63,7 @@ sub alias_specified {
        } @address;
 
        foreach my $line ($simple->header('Cc'), $simple->header('To')) {
-               my @addrs = ($line =~ /([^,<\s]+\@[^,>\s]+)/g);
+               my @addrs = PublicInbox::Address::emails($line);
                foreach my $addr (@addrs) {
                        if ($ok{lc(__drop_plus($addr))}) {
                                return 1;