Skip to content

Commit

Permalink
Improved MimeParser.StepMboxMarker() logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Sep 4, 2021
1 parent c3a53ee commit 8467b75
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions MimeKit/MimeParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,12 @@ unsafe bool StepMboxMarker (byte* inbuf, ref int left)
while (*inptr != (byte) '\n')
inptr++;

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

var markerLength = (int) (inptr - start);

if (inptr > start && *(inptr - 1) == (byte) '\r')
Expand All @@ -719,12 +725,6 @@ unsafe bool StepMboxMarker (byte* inbuf, ref int left)

var lineLength = (int) (inptr - start);

if (inptr >= inend) {
// we don't have enough input data
left = lineLength;
return false;
}

inputIndex += lineLength;
prevLineBeginOffset = lineBeginOffset;
lineBeginOffset = GetOffset (inputIndex);
Expand Down

0 comments on commit 8467b75

Please # to comment.