From ee49e1fcb6c89d0206ea65d5c0adc523e33baddb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 22 Mar 2019 11:52:55 -0400 Subject: [PATCH] file_sys/patch_manager: Remove two magic values These correspond to the NSOBuildHeader. --- src/core/file_sys/patch_manager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 2b09e5d35..efc572c72 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -163,8 +163,9 @@ std::vector PatchManager::CollectPatches(const std::vector PatchManager::PatchNSO(const std::vector& nso) const { - if (nso.size() < 0x100) + if (nso.size() < sizeof(NSOBuildHeader)) { return nso; + } NSOBuildHeader header; std::memcpy(&header, nso.data(), sizeof(NSOBuildHeader)); @@ -213,8 +214,10 @@ std::vector PatchManager::PatchNSO(const std::vector& nso) const { } } - if (out.size() < 0x100) + if (out.size() < sizeof(NSOBuildHeader)) { return nso; + } + std::memcpy(out.data(), &header, sizeof(NSOBuildHeader)); return out; }