Skip to content

Commit

Permalink
Make sure not to hang if the last header line is truncated before CRLF
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Feb 8, 2018
1 parent 54b599e commit 801ac47
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion MimeKit/MimeParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,17 @@ unsafe bool StepHeaders (byte* inbuf, ref bool scanningFieldName, ref bool check

if (inptr == inend) {
// we don't have enough input data
left = (int) (inend - start);
int available = (int) (inend - start);

inputIndex = (int) (start - inbuf);

if (left == available) {
state = MimeParserState.Error;
headerIndex = 0;
return false;
}

left = available;
needInput = true;
break;
}
Expand Down

0 comments on commit 801ac47

Please sign in to comment.