From c0f3095c2f0fdf3409a2d7bc629230cd83a06f9f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 19 Jun 2020 17:18:47 +0000 Subject: mda: use PublicInbox::Address to extract emails 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm index 57b436b9..fa4a2ad8 100644 --- a/lib/PublicInbox/MDA.pm +++ b/lib/PublicInbox/MDA.pm @@ -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; -- cgit v1.2.3-24-ge0c7