Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End MIME boundary should be followed by CRLF #580

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 19 additions & 3 deletions api/src/main/java/jakarta/mail/internet/MimeMultipart.java
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,25 @@ protected synchronized void parse() throws MessagingException {
int b2 = in.read();
if (b2 == '-') {
if (in.read() == '-') {
complete = true;
done = true;
break; // ignore trailing text
int b3 = in.read();
// skip linear whitespace
while (b3 == ' ' || b3 == '\t')
{ b3 = in.read(); }
if (b3 == '\n' || b3 == '\r' || b3 == -1)
{
if(b3 == '\r')
{
// consume '\n' if it follows, so that next read
// starts from first character of the epilogue.
// useful if in future epilogue extraction is added
in.mark(1);
if (in.read() != '\n')
{ in.reset(); }
}
complete = true;
done = true;
break; // ignore trailing text
}
}
}
// skip linear whitespace
Expand Down