From ae6fe033c2467016c5351875e88feca9a1b21f13 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 17 Aug 2025 15:38:44 +0100 Subject: [PATCH] Better guards against certaing EVPD page 80h. --- Aaru.Decoders/SCSI/EVPD.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Aaru.Decoders/SCSI/EVPD.cs b/Aaru.Decoders/SCSI/EVPD.cs index b64088671..ae312dac6 100644 --- a/Aaru.Decoders/SCSI/EVPD.cs +++ b/Aaru.Decoders/SCSI/EVPD.cs @@ -100,6 +100,8 @@ public static class EVPD for(int i = 0; i < ascii.Length - 1; i++) { + if(ascii[i] == 0x00) break; + if(ascii[i] < 0x20) return null; } @@ -553,9 +555,11 @@ public static class EVPD break; case IdentificationTypes.EUI: if(descriptor.CodeSet is IdentificationCodeSet.ASCII or IdentificationCodeSet.UTF8) + { sb.AppendFormat($"\t[slateblue1]{Localization.IEEE_EUI_64_0}[/]", $"[teal]{Markup.Escape(descriptor.ASCII)}[/]") .AppendLine(); + } else { sb.AppendFormat($"\t[slateblue1]{Localization.IEEE_EUI_64_0_X2}", @@ -569,9 +573,11 @@ public static class EVPD break; case IdentificationTypes.NAA: if(descriptor.CodeSet is IdentificationCodeSet.ASCII or IdentificationCodeSet.UTF8) + { sb.AppendFormat($"\t[slateblue1]{Localization.NAA_0}[/]", $"[teal]{Markup.Escape(descriptor.ASCII)}[/]") .AppendLine(); + } else { sb.AppendFormat($"\t[slateblue1]{Localization.NAA_0_X2}", $"[teal]{descriptor.Binary[0]}"); @@ -600,9 +606,11 @@ public static class EVPD break; case IdentificationTypes.TargetPortGroup: if(descriptor.CodeSet is IdentificationCodeSet.ASCII or IdentificationCodeSet.UTF8) + { sb.AppendFormat($"\t[slateblue1]{Localization.Target_group_identifier_0}[/]", $"[teal]{Markup.Escape(descriptor.ASCII)}[/]") .AppendLine(); + } else { sb.AppendFormat("\t[slateblue1]{ Localization.Target_group_identifier_0}[/]",