From e7768839c5a731ed4df577232d66bd8dc8f8aca6 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 3 Jun 2017 01:11:51 +0100 Subject: [PATCH] Corrected when EVPD is smaller than length field. --- SCSI/EVPD.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SCSI/EVPD.cs b/SCSI/EVPD.cs index b5340b79e..02f159068 100644 --- a/SCSI/EVPD.cs +++ b/SCSI/EVPD.cs @@ -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);