Better to make extra sure here
This commit is contained in:
parent
a0325e91f9
commit
2cc46c618b
@ -312,16 +312,19 @@ static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource, bo
|
|||||||
|
|
||||||
if(firmSize > 0)
|
if(firmSize > 0)
|
||||||
{
|
{
|
||||||
|
bool isValidFirm = true;
|
||||||
|
|
||||||
if(memcmp(firm, "FIRM", 4) != 0)
|
if(memcmp(firm, "FIRM", 4) != 0)
|
||||||
{
|
{
|
||||||
u8 cetk[0xA50];
|
u8 cetk[0xA50];
|
||||||
|
|
||||||
if(fileRead(cetk, *firmType == NATIVE_FIRM1X2X ? cetkFiles[0] : cetkFiles[(u32)*firmType], sizeof(cetk)) == sizeof(cetk))
|
if(fileRead(cetk, *firmType == NATIVE_FIRM1X2X ? cetkFiles[0] : cetkFiles[(u32)*firmType], sizeof(cetk)) == sizeof(cetk))
|
||||||
decryptNusFirm(cetk, (u8 *)firm, firmSize);
|
decryptNusFirm(cetk, (u8 *)firm, firmSize);
|
||||||
|
else isValidFirm = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check that the SD FIRM is right for the console from the ARM9 section address
|
//Check that the SD FIRM is decrypted and is right for the console from the ARM9 section address
|
||||||
if((section[3].offset ? section[3].address : section[2].address) != (isN3DS ? (u8 *)0x8006000 : (u8 *)0x8006800))
|
if(isValidFirm && (section[3].offset ? section[3].address : section[2].address) != (isN3DS ? (u8 *)0x8006000 : (u8 *)0x8006800))
|
||||||
{
|
{
|
||||||
if(isFirmlaunch) mcuReboot();
|
if(isFirmlaunch) mcuReboot();
|
||||||
error("The firmware.bin in /luma is not valid for your\nconsole, or corrupted");
|
error("The firmware.bin in /luma is not valid for your\nconsole, or corrupted");
|
||||||
|
Reference in New Issue
Block a user