Fix invalid reads

This commit is contained in:
Matt Nadareski
2021-09-11 20:58:44 -07:00
parent 1bc8fe7ff6
commit 9d52ca4b4c

View File

@@ -25,7 +25,7 @@ namespace BurnOutSharp.Tools
public static byte[] ReadBytes(this byte[] content, ref int offset, int count)
{
byte[] buffer = new byte[count];
Array.Copy(content, offset, buffer, 0, count);
Array.Copy(content, offset, buffer, 0, Math.Min(count, content.Length - offset));
offset += count;
return buffer;
}