Skip to content

Commit

Permalink
Merge pull request #27 from lucasgl/master
Browse files Browse the repository at this point in the history
Fix read string bigger than 128 bytes from Stream.
  • Loading branch information
xoofx authored Oct 5, 2023
2 parents 5747489 + babfc56 commit 1cc2ab3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/LibObjectFile/ObjectFileStreamExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static string ReadStringUTF8NullTerminated(this Stream stream)
break;
}

if (textLength > buffer.Length)
if (textLength >= buffer.Length)
{
var newBuffer = ArrayPool<byte>.Shared.Rent((int)textLength * 2);
Array.Copy(buffer, 0, newBuffer, 0, buffer.Length);
Expand Down

0 comments on commit 1cc2ab3

Please sign in to comment.