Return if the FIRM payloads filesize is different than expected
This commit is contained in:
parent
47369c8f5e
commit
ba3740a77a
@ -423,17 +423,19 @@ static __attribute__((noinline)) bool inRange(u32 as, u32 ae, u32 bs, u32 be)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool checkFirmPayload(void)
|
||||
bool checkFirmPayload(u32 payloadSize)
|
||||
{
|
||||
if(memcmp(firm->magic, "FIRM", 4) != 0 || firm->arm9Entry == NULL) //Allow for the ARM11 entrypoint to be zero in which case nothing is done on the ARM11 side
|
||||
return false;
|
||||
|
||||
bool arm9EpFound = false,
|
||||
arm11EpFound = false;
|
||||
|
||||
u32 size = 0x200;
|
||||
for(u32 i = 0; i < 4; i++)
|
||||
size += firm->section[i].size;
|
||||
|
||||
bool arm9EpFound = false,
|
||||
arm11EpFound = false;
|
||||
if(size != payloadSize) return false;
|
||||
|
||||
for(u32 i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -33,6 +33,5 @@ u32 patchTwlFirm(u32 firmVersion, bool loadFromStorage, bool doUnitinfoPatch);
|
||||
u32 patchAgbFirm(bool loadFromStorage, bool doUnitinfoPatch);
|
||||
u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers);
|
||||
|
||||
bool checkFirmPayload(void);
|
||||
bool checkFirmPayload(u32 payloadSize);
|
||||
void launchFirm(int argc, char **argv);
|
||||
|
||||
|
@ -161,7 +161,7 @@ void loadPayload(u32 pressed, const char *payloadPath)
|
||||
|
||||
payloadSize = fileRead(firm, path, maxPayloadSize);
|
||||
|
||||
if(payloadSize <= 0x200 || !checkFirmPayload()) return;
|
||||
if(payloadSize <= 0x200 || !checkFirmPayload(payloadSize)) return;
|
||||
|
||||
writeConfig(true);
|
||||
|
||||
|
Reference in New Issue
Block a user