summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorKhang <khang06@users.noreply.github.com>2026-07-15 02:12:31 -0400
committerKhang <khang06@users.noreply.github.com>2026-07-15 02:12:31 -0400
commit900febec29bcfee8b7a1319ec74d9cb1bfb9d157 (patch)
tree1b60ba185ea57374be6523bc1fe663d80c3e7109 /Source
parent774200dcf4ccea148ef357cc8cf86d8eab4446da (diff)
IOS/ES: Prevent reading TMDs that are too small
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/IOS/ES/Formats.cpp2
-rw-r--r--Source/Core/Core/IOS/WFS/WFSI.cpp2
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp
index e055f72564..d041514171 100644
--- a/Source/Core/Core/IOS/ES/Formats.cpp
+++ b/Source/Core/Core/IOS/ES/Formats.cpp
@@ -194,7 +194,7 @@ void SignedBlobReader::DoState(PointerWrap& p)
bool IsValidTMDSize(size_t size)
{
- return size <= 0x49e4;
+ return size >= sizeof(TMDHeader) && size <= 0x49e4;
}
TMDReader::TMDReader(std::vector<u8> bytes) : SignedBlobReader(std::move(bytes))
diff --git a/Source/Core/Core/IOS/WFS/WFSI.cpp b/Source/Core/Core/IOS/WFS/WFSI.cpp
index c037967d6a..73bf030dea 100644
--- a/Source/Core/Core/IOS/WFS/WFSI.cpp
+++ b/Source/Core/Core/IOS/WFS/WFSI.cpp
@@ -156,7 +156,7 @@ std::optional<IPCReply> WFSIDevice::IOCtl(const IOCtlRequest& request)
if (!ES::IsValidTMDSize(tmd_size))
{
- ERROR_LOG_FMT(IOS_WFS, "IOCTL_WFSI_IMPORT_TITLE_INIT: TMD size too large ({})", tmd_size);
+ ERROR_LOG_FMT(IOS_WFS, "IOCTL_WFSI_IMPORT_TITLE_INIT: TMD size invalid ({})", tmd_size);
return_error_code = IPC_EINVAL;
break;
}
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index 39961a6c18..974592fea0 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -51,7 +51,7 @@ VolumeWAD::VolumeWAD(std::unique_ptr<BlobReader> reader) : m_reader(std::move(re
if (!IOS::ES::IsValidTMDSize(m_tmd_size))
{
- ERROR_LOG_FMT(DISCIO, "TMD is too large: {} bytes", m_tmd_size);
+ ERROR_LOG_FMT(DISCIO, "TMD has an invalid size: {} bytes", m_tmd_size);
return;
}