From ef5329a0d436b722efe3fc47cc1f116b3a9f1344 Mon Sep 17 00:00:00 2001 From: Mary Date: Tue, 20 Jun 2023 08:35:48 +0200 Subject: [PATCH] fix: do not allocate exheader on the stack as it has a variable length Fix build on Windows hopefully. --- src/core/loader/ncch.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 196a29d4..fb121fa5 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -102,9 +102,9 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn } if (exheaderSize != 0) { - u8 exheader[exheaderSize]; + std::unique_ptr exheader(new u8[exheaderSize]); - auto [success, bytes] = readFromFile(file, info, exheader, 0x200, exheaderSize); + auto [success, bytes] = readFromFile(file, info, &exheader[0], 0x200, exheaderSize); if (!success || bytes != exheaderSize) { printf("Failed to read Extended NCCH header\n"); return false; @@ -120,7 +120,7 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn } // If it's truely encrypted, we need to read section again. if (encrypted) { - auto [success, bytes] = readFromFile(file, exheaderInfo, exheader, 0, exheaderSize); + auto [success, bytes] = readFromFile(file, exheaderInfo, &exheader[0], 0, exheaderSize); if (!success || bytes != exheaderSize) { printf("Failed to read Extended NCCH header\n"); return false;