From c8586cfe26cc884218ad416ca8b7acfd2b0739f1 Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 20 Sep 2016 15:16:19 +0200 Subject: [PATCH] Account for trailing newlines in .txts --- injector/source/patcher.c | 8 ++++---- source/crypto.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 4db7878..61a8e6f 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -77,7 +77,7 @@ static void loadCustomVerString(u16 *out, u32 *verStringSize) { u64 fileSize; - if(R_SUCCEEDED(IFile_GetSize(&file, &fileSize)) && fileSize <= 60) + if(R_SUCCEEDED(IFile_GetSize(&file, &fileSize)) && fileSize <= 61) { u8 buf[fileSize]; u64 total; @@ -159,12 +159,12 @@ static void loadTitleLocaleConfig(u64 progId, u8 *regionId, u8 *languageId) { u64 fileSize; - if(R_SUCCEEDED(IFile_GetSize(&file, &fileSize)) && fileSize == 6) + if(R_SUCCEEDED(IFile_GetSize(&file, &fileSize)) && (fileSize == 6 || fileSize == 7)) { - char buf[6]; + char buf[fileSize]; u64 total; - if(R_SUCCEEDED(IFile_Read(&file, &total, buf, 6))) + if(R_SUCCEEDED(IFile_Read(&file, &total, buf, fileSize))) { for(u32 i = 0; i < 7; i++) { diff --git a/source/crypto.c b/source/crypto.c index ec99a86..7262078 100755 --- a/source/crypto.c +++ b/source/crypto.c @@ -484,6 +484,6 @@ void computePinHash(u8 *outbuf, const u8 *inbuf) sdmmc_get_cid(1, (u32 *)cid); aes_use_keyslot(4); //Console-unique keyslot whose keys are set by the ARM9 bootROM - aes(cipherText, in, 1, cid, AES_CBC_ENCRYPT_MODE, AES_INPUT_BE | AES_INPUT_NORMAL); - sha(out, cipherText, sizeof(cipherText), SHA_256_MODE); + aes(cipherText, inbuf, 1, cid, AES_CBC_ENCRYPT_MODE, AES_INPUT_BE | AES_INPUT_NORMAL); + sha(outbuf, cipherText, sizeof(cipherText), SHA_256_MODE); } \ No newline at end of file