Add missing checks in getFreeK9Space

This commit is contained in:
Aurora Wright 2017-06-20 19:56:34 +02:00
parent 31ff6a1da8
commit 9b8e2b933d

View File

@ -107,7 +107,8 @@ static inline bool getFreeK9Space(u8 *pos, u32 size, u8 **freeK9Space)
//Looking for the last free space before Process9
*freeK9Space = memsearch(pos, pattern, size, sizeof(pattern));
if(*freeK9Space == NULL) return false;
if(*freeK9Space == NULL || (u32)(pos + size - *freeK9Space) < 0x455 + emunand_bin_size ||
*(u32 *)(*freeK9Space + 0x455 + emunand_bin_size - 4) != 0xFFFFFFFF) return false;
*freeK9Space += 0x455;