From cbc7c2d3858aab404974a16be2b3cf54e98c923a Mon Sep 17 00:00:00 2001 From: Sepalani Date: Mon, 2 Feb 2026 22:35:59 +0400 Subject: SI_DeviceAMBaseboard: Add missing bounds checks VolumeDisc: Fix Triforce's GetGameID memcpy by checking MakerID's size --- Source/Core/DiscIO/VolumeDisc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/DiscIO/VolumeDisc.cpp') 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(maker_id.size(), 2)); return DecodeString(id); } -- cgit v1.2.3