From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id ED5581F5AE for ; Fri, 19 Jun 2020 17:18:47 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [RFC] mda: use PublicInbox::Address to extract emails Date: Fri, 19 Jun 2020 17:18:47 +0000 Message-Id: <20200619171847.7852-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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(-) 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;