Corrected when EVPD is smaller than length field.

This commit is contained in:
2017-06-03 01:11:51 +01:00
parent 5f5bda6d28
commit 3b8d9cd78a

View File

@@ -434,6 +434,8 @@ namespace DiscImageChef.Decoders.SCSI
descriptor.Type = (IdentificationTypes)(pageResponse[position + 1] & 0x0F);
descriptor.Length = pageResponse[position + 3];
descriptor.Binary = new byte[descriptor.Length];
if(descriptor.Length + position + 4 >= pageResponse.Length)
descriptor.Length = (byte)(pageResponse.Length - position - 4);
Array.Copy(pageResponse, position + 4, descriptor.Binary, 0, descriptor.Length);
if(descriptor.CodeSet == IdentificationCodeSet.ASCII)
descriptor.ASCII = StringHandlers.CToString(descriptor.Binary);