diff --git a/src/com/android/email/mail/store/imap/ImapResponseParser.java b/src/com/android/email/mail/store/imap/ImapResponseParser.java index 0c5d07b44..4433105dc 100644 --- a/src/com/android/email/mail/store/imap/ImapResponseParser.java +++ b/src/com/android/email/mail/store/imap/ImapResponseParser.java @@ -438,6 +438,9 @@ public class ImapResponseParser { } catch (NumberFormatException nfe) { throw new MessagingException("Invalid length in literal"); } + if (size < 0) { + throw new MessagingException("Invalid negative length in literal"); + } expect('\r'); expect('\n'); FixedLengthInputStream in = new FixedLengthInputStream(mIn, size);