mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 12:39:16 +08:00
(UCA): check for invalid characters in filenames.
This commit is contained in:
parent
81a6d86c7e
commit
9eaa5d8e2b
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace GameRes.Formats.WestGate
|
namespace GameRes.Formats.WestGate
|
||||||
{
|
{
|
||||||
@ -61,11 +62,12 @@ namespace GameRes.Formats.WestGate
|
|||||||
uint next_offset = file.View.ReadUInt32 (index_offset+0xC);
|
uint next_offset = file.View.ReadUInt32 (index_offset+0xC);
|
||||||
if (next_offset < data_offset)
|
if (next_offset < data_offset)
|
||||||
return null;
|
return null;
|
||||||
|
var invalid_chars = Path.GetInvalidFileNameChars();
|
||||||
var dir = new List<Entry> (count);
|
var dir = new List<Entry> (count);
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
var name = file.View.ReadString (index_offset, 0xC);
|
var name = file.View.ReadString (index_offset, 0xC);
|
||||||
if (string.IsNullOrWhiteSpace (name))
|
if (string.IsNullOrWhiteSpace (name) || name.IndexOfAny (invalid_chars) != -1)
|
||||||
return null;
|
return null;
|
||||||
index_offset += 0x10;
|
index_offset += 0x10;
|
||||||
var entry = new Entry { Name = name, Type = entry_type };
|
var entry = new Entry { Name = name, Type = entry_type };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user