From ff0f517cbb0c41adab90e646eeb06c7acebef7ec Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 1 Feb 2011 20:48:20 +0000 Subject: [PATCH] Configure MIME4J to not die when there are long header lines or a large message header --- src/com/fsck/k9/mail/internet/MimeMessage.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/mail/internet/MimeMessage.java b/src/com/fsck/k9/mail/internet/MimeMessage.java index a151fb4df..7f2b0cffa 100644 --- a/src/com/fsck/k9/mail/internet/MimeMessage.java +++ b/src/com/fsck/k9/mail/internet/MimeMessage.java @@ -9,6 +9,7 @@ import org.apache.james.mime4j.stream.RawField; import org.apache.james.mime4j.parser.ContentHandler; import org.apache.james.mime4j.io.EOLConvertingInputStream; import org.apache.james.mime4j.parser.MimeStreamParser; +import org.apache.james.mime4j.stream.MimeEntityConfig; import org.apache.james.mime4j.dom.field.DateTimeField; import org.apache.james.mime4j.dom.field.Field; import org.apache.james.mime4j.field.DefaultFieldParser; @@ -76,7 +77,11 @@ public class MimeMessage extends Message mBody = null; - MimeStreamParser parser = new MimeStreamParser(); + MimeEntityConfig parserConfig = new MimeEntityConfig(); + parserConfig.setMaxHeaderLen(-1); // The default is a mere 10k + parserConfig.setMaxLineLen(-1); // The default is 1000 characters. Some MUAs generate + // REALLY long References: headers + MimeStreamParser parser = new MimeStreamParser(parserConfig); parser.setContentHandler(new MimeMessageBuilder()); try {