Check MMC features length before copying array.

This commit is contained in:
2017-08-22 03:56:58 +01:00
parent 310c932303
commit 2161bb9dd6
3 changed files with 2 additions and 0 deletions

Binary file not shown.

View File

@@ -5782,6 +5782,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC
FeatureDescriptor desc = new FeatureDescriptor();
desc.Code = (ushort)((response[offset + 0] << 8) + response[offset + 1]);
desc.Data = new byte[response[offset + 3] + 4];
if (desc.Data.Length + offset > response.Length)
desc.Data = new byte[response.Length - offset];
Array.Copy(response, offset, desc.Data, 0, desc.Data.Length);
offset += (uint)(desc.Data.Length);