about summary refs log tree commit homepage
path: root/script/public-inbox-learn
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-25 01:44:46 +0000
committerEric Wong <e@80x24.org>2016-05-25 01:49:54 +0000
commit23a4e44bedabe5b8b651346cabc2a870c5377a30 (patch)
treee92220e935276cd1a2f466fa4bc6bf1e29fdb8e0 /script/public-inbox-learn
parent64aea34d06f71828b0bdd6ae177b9bcf22d752b4 (diff)
downloadpublic-inbox-23a4e44bedabe5b8b651346cabc2a870c5377a30.tar.gz
git has stricter requirements for ident names (no '<>')
which Email::Address allows.

Even in 1.908, Email::Address also has an incomplete fix for
CVE-2015-7686 with a DoS-able regexp for comments.  Since we
don't care for or need all the RFC compliance of Email::Address,
avoiding it entirely may be preferable.

Email::Address will still be installed as a requirement for
Email::MIME, but it is only used by the
Email::MIME::header_str_set which we do not use
Diffstat (limited to 'script/public-inbox-learn')
-rwxr-xr-xscript/public-inbox-learn7
1 files changed, 4 insertions, 3 deletions
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index 1c051ec1..c79f2479 100755
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -11,7 +11,7 @@ use PublicInbox::Config;
 use PublicInbox::Git;
 use PublicInbox::Import;
 use Email::MIME;
-use Email::Address;
+use PublicInbox::Address;
 use IPC::Run qw/run/;
 my $train = shift or die "usage: $usage\n";
 if ($train !~ /\A(?:ham|spam)\z/) {
@@ -29,8 +29,9 @@ my $mime = Email::MIME->new(eval {
 # get all recipients
 my %dests;
 foreach my $h (qw(Cc To)) {
-        foreach my $recipient (Email::Address->parse($mime->header($h))) {
-                $dests{lc($recipient->address)} = 1;
+        my $val = $mime->header($h) or next;
+        foreach my $email (PublicInbox::Address::emails($val)) {
+                $dests{lc($email)} = 1;
         }
 }