Only check in .text

This commit is contained in:
Aurora Wright 2017-06-28 17:57:09 +02:00
parent 9f78d7f62b
commit b88dc9ac6a

View File

@ -260,8 +260,7 @@ static inline bool findLayeredFsPayloadOffset(u8 *code, u32 size, u32 roSize, u3
if(*(u32 *)(code + pos) == 0xE200167E) func = 0xFFFFFFFF;
}
if(func != 0xFFFFFFFF)
*payloadOffset = func;
if(func != 0xFFFFFFFF) *payloadOffset = func;
}
}
@ -614,7 +613,7 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
//Patch SMDH region check for manuals
u32 i;
for(i = 4; i < size; i += 4)
for(i = 4; i < textSize; i += 4)
{
u32 *code32 = (u32 *)(code + i);
if(code32[1] == 0xE1A0000D && (*code32 & 0xFFFFFF00) == 0x0A000000 && (code32[-1] & 0xFFFFFF00) == 0xE1110000)
@ -624,7 +623,7 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
}
}
if(i == size) goto error;
if(i == textSize) goto error;
//Patch DS flashcart whitelist check
static const u8 pattern[] = {