From 9f25b6cf25e0e84dc2b23d295afdb38ceebec38a Mon Sep 17 00:00:00 2001 From: d0k3 Date: Mon, 29 Oct 2018 00:04:23 +0100 Subject: [PATCH] Improved TMD checks --- arm9/source/utils/gameutil.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arm9/source/utils/gameutil.c b/arm9/source/utils/gameutil.c index 3e83867..9d7c88f 100644 --- a/arm9/source/utils/gameutil.c +++ b/arm9/source/utils/gameutil.c @@ -185,12 +185,11 @@ u32 LoadNcchMeta(CiaMeta* meta, const char* path, u64 offset) { } u32 LoadTmdFile(TitleMetaData* tmd, const char* path) { - const u8 magic[] = { TMD_SIG_TYPE }; UINT br; // full TMD file if ((fvx_qread(path, tmd, 0, TMD_SIZE_MAX, &br) != FR_OK) || - (memcmp(tmd->sig_type, magic, sizeof(magic)) != 0) || + (br < TMD_SIZE_MIN) || (ValidateTmd(tmd) != 0) || (br < TMD_SIZE_N(getbe16(tmd->content_count)))) return 1;