From 6027ff243d0741e096df085bebee647feb2b286f Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 12 Feb 2019 02:53:31 -0800 Subject: [PATCH] Enforce upper bound on application tid range --- stratosphere/ams_mitm/source/utils.cpp | 4 ++-- stratosphere/libstratosphere | 2 +- stratosphere/loader/source/ldr_content_management.cpp | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/stratosphere/ams_mitm/source/utils.cpp b/stratosphere/ams_mitm/source/utils.cpp index 81c5db99b..637113fdc 100644 --- a/stratosphere/ams_mitm/source/utils.cpp +++ b/stratosphere/ams_mitm/source/utils.cpp @@ -368,7 +368,7 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data, } bool Utils::IsHblTid(u64 tid) { - return (g_override_any_app && tid >= 0x0100000000010000ULL) || (!g_override_any_app && tid == g_override_hbl_tid); + return (g_override_any_app && IsApplicationTid(tid)) || (!g_override_any_app && tid == g_override_hbl_tid); } bool Utils::HasTitleFlag(u64 tid, const char *flag) { @@ -447,7 +447,7 @@ Result Utils::GetKeysDown(u64 *keys) { } bool Utils::HasOverrideButton(u64 tid) { - if (tid < 0x0100000000010000ULL || !IsSdInitialized()) { + if ((!IsApplicationTid(tid)) || (!IsSdInitialized())) { /* Disable button override disable for non-applications. */ return true; } diff --git a/stratosphere/libstratosphere b/stratosphere/libstratosphere index fb12edcbb..a2c74f8cd 160000 --- a/stratosphere/libstratosphere +++ b/stratosphere/libstratosphere @@ -1 +1 @@ -Subproject commit fb12edcbbaa5ef7a08fbb44d4aa13f0f37136537 +Subproject commit a2c74f8cd5311f8050bcc5ea7d07b1ba4b697558 diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index 77a17bb5d..b5fbbb491 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -309,7 +310,7 @@ void ContentManagement::TryMountSdCard() { } bool ContentManagement::ShouldReplaceWithHBL(u64 tid) { - return g_mounted_hbl_nsp && ((g_override_any_app && tid >= 0x0100000000010000) || (!g_override_any_app && tid == g_override_hbl_tid)); + return g_mounted_hbl_nsp && ((g_override_any_app && IsApplicationTid(tid)) || (!g_override_any_app && tid == g_override_hbl_tid)); } bool ContentManagement::ShouldOverrideContents(u64 tid) {