Add several out of bounds and null protections against rogue MMC firmwares.

This commit is contained in:
2018-06-19 21:35:23 +01:00
parent bdaece414e
commit 414262f574
3 changed files with 12 additions and 3 deletions

View File

@@ -400,6 +400,8 @@ namespace DiscImageChef.Devices
Error = LastError != 0;
uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
if(strctLength > tmpBuffer.Length) strctLength = (uint)tmpBuffer.Length;
buffer = new byte[strctLength];
Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length);