mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 21:55:34 +08:00
(NFS): entry name sanity check.
This commit is contained in:
parent
0ca4a04ff7
commit
89feec7e4d
@ -56,8 +56,7 @@ namespace GameRes.Formats.Nags
|
|||||||
if (first_offset != 0)
|
if (first_offset != 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var index = new byte[index_size];
|
var index = file.View.ReadBytes (4, index_size);
|
||||||
file.View.Read (4, index, 0, index_size);
|
|
||||||
for (int i = 0; i < index.Length; ++i)
|
for (int i = 0; i < index.Length; ++i)
|
||||||
index[i] ^= key;
|
index[i] ^= key;
|
||||||
|
|
||||||
@ -67,6 +66,8 @@ namespace GameRes.Formats.Nags
|
|||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
var name = Binary.GetCString (index, index_offset, 0x18);
|
var name = Binary.GetCString (index, index_offset, 0x18);
|
||||||
|
if (0 == name.Length)
|
||||||
|
return null;
|
||||||
var entry = FormatCatalog.Instance.Create<Entry> (name);
|
var entry = FormatCatalog.Instance.Create<Entry> (name);
|
||||||
entry.Offset = base_offset + LittleEndian.ToUInt32 (index, index_offset+0x18);
|
entry.Offset = base_offset + LittleEndian.ToUInt32 (index, index_offset+0x18);
|
||||||
entry.Size = LittleEndian.ToUInt32 (index, index_offset+0x1C);
|
entry.Size = LittleEndian.ToUInt32 (index, index_offset+0x1C);
|
||||||
|
Loading…
Reference in New Issue
Block a user