- add check for bounds of internal cheats;
This commit is contained in:
parent
e629f9ea7a
commit
3969516d0b
|
@ -655,6 +655,11 @@ BOOL CHEATS::load()
|
||||||
strcpy(tmp_cht.description, (buf + descr_pos + 1));
|
strcpy(tmp_cht.description, (buf + descr_pos + 1));
|
||||||
|
|
||||||
tmp_cht.num = strlen(tmp_code) / 16;
|
tmp_cht.num = strlen(tmp_code) / 16;
|
||||||
|
if ((tmp_cht.type == 0) && (tmp_cht.num > 1))
|
||||||
|
{
|
||||||
|
INFO("Cheats: Too many values for internal cheat\n", line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (int i = 0; i < tmp_cht.num; i++)
|
for (int i = 0; i < tmp_cht.num; i++)
|
||||||
{
|
{
|
||||||
char tmp_buf[9] = {0};
|
char tmp_buf[9] = {0};
|
||||||
|
@ -665,6 +670,7 @@ BOOL CHEATS::load()
|
||||||
if (tmp_cht.type == 0)
|
if (tmp_cht.type == 0)
|
||||||
{
|
{
|
||||||
tmp_cht.size = std::min<u32>(3, ((tmp_cht.code[i][0] & 0xF0000000) >> 28));
|
tmp_cht.size = std::min<u32>(3, ((tmp_cht.code[i][0] & 0xF0000000) >> 28));
|
||||||
|
tmp_cht.code[i][0] &= 0x00FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(tmp_buf, (char*)(tmp_code + (i*16) + 8), 8);
|
strncpy(tmp_buf, (char*)(tmp_code + (i*16) + 8), 8);
|
||||||
|
|
Loading…
Reference in New Issue