(IntOpener.DecipherName): check for array bounds.

This commit is contained in:
morkt 2015-11-20 17:47:02 +04:00
parent 33e83b196d
commit 1f7e1e9f50

View File

@ -214,7 +214,7 @@ namespace GameRes.Formats.CatSystem
string alphabet = "zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA"; string alphabet = "zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA";
int k = (byte)((key >> 24) + (key >> 16) + (key >> 8) + key); int k = (byte)((key >> 24) + (key >> 16) + (key >> 8) + key);
int i; int i;
for (i = 0; name[i] != 0; ++i) for (i = 0; i < name.Length && name[i] != 0; ++i)
{ {
int j = alphabet.IndexOf ((char)name[i]); int j = alphabet.IndexOf ((char)name[i]);
if (j != -1) if (j != -1)