summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeDisc.cpp
diff options
context:
space:
mode:
authorSepalani <sepalani@hotmail.fr>2026-02-02 22:35:59 +0400
committerJordan Woyak <jordan.woyak@gmail.com>2026-02-15 20:14:15 -0600
commitcbc7c2d3858aab404974a16be2b3cf54e98c923a (patch)
tree2a106f3a541d6f696cb3ee5bbf45ff6eedebd200 /Source/Core/DiscIO/VolumeDisc.cpp
parent0acb6145f72826af8d1d73f7fadba1e1ec72fca7 (diff)
SI_DeviceAMBaseboard: Add missing bounds checks
VolumeDisc: Fix Triforce's GetGameID memcpy by checking MakerID's size
Diffstat (limited to 'Source/Core/DiscIO/VolumeDisc.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeDisc.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/Core/DiscIO/VolumeDisc.cpp b/Source/Core/DiscIO/VolumeDisc.cpp
index 5913f63c11..ecbb4a9dc9 100644
--- a/Source/Core/DiscIO/VolumeDisc.cpp
+++ b/Source/Core/DiscIO/VolumeDisc.cpp
@@ -18,7 +18,7 @@ namespace DiscIO
{
std::string VolumeDisc::GetGameID(const Partition& partition) const
{
- char id[6];
+ char id[6]{};
if (GetVolumeType() == Platform::Triforce)
{
@@ -47,7 +47,8 @@ std::string VolumeDisc::GetGameID(const Partition& partition) const
break;
}
- memcpy(id + 4, GetMakerID().c_str(), 2);
+ const std::string maker_id{GetMakerID()};
+ memcpy(id + 4, maker_id.c_str(), std::min<std::size_t>(maker_id.size(), 2));
return DecodeString(id);
}