Fixed possible issue with the injector

This commit is contained in:
Aurora 2016-04-11 17:57:22 +02:00
parent d4d281bb9c
commit 7479bf8092

View File

@ -44,16 +44,15 @@ static u32 patchMemory(u8 *start, u32 size, const void *pattern, u32 patSize, in
{
u8 *found = memsearch(start, pattern, size, patSize);
if(found == NULL)
break;
if(found == NULL) break;
memcpy(found + offset, replace, repSize);
u32 at = (u32)(found - start);
if(at + patSize > size) size = 0;
else size = size - (at + patSize);
if(at + patSize > size) break;
size -= at + patSize;
start = found + patSize;
}