From 9eaa5d8e2b1a7576b7e3df0485e0fbb3ddc31dd6 Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 24 Apr 2018 21:04:26 +0400 Subject: [PATCH] (UCA): check for invalid characters in filenames. --- Legacy/WestGate/ArcUCA.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Legacy/WestGate/ArcUCA.cs b/Legacy/WestGate/ArcUCA.cs index c1b1ac7c..c0a05006 100644 --- a/Legacy/WestGate/ArcUCA.cs +++ b/Legacy/WestGate/ArcUCA.cs @@ -25,6 +25,7 @@ using System.Collections.Generic; using System.ComponentModel.Composition; +using System.IO; namespace GameRes.Formats.WestGate { @@ -61,11 +62,12 @@ namespace GameRes.Formats.WestGate uint next_offset = file.View.ReadUInt32 (index_offset+0xC); if (next_offset < data_offset) return null; + var invalid_chars = Path.GetInvalidFileNameChars(); var dir = new List (count); for (int i = 0; i < count; ++i) { var name = file.View.ReadString (index_offset, 0xC); - if (string.IsNullOrWhiteSpace (name)) + if (string.IsNullOrWhiteSpace (name) || name.IndexOfAny (invalid_chars) != -1) return null; index_offset += 0x10; var entry = new Entry { Name = name, Type = entry_type };