SI_DeviceAMBaseboard: Add missing bounds checks

VolumeDisc: Fix Triforce's GetGameID memcpy by checking MakerID's size
This commit is contained in:
Sepalani
2026-02-04 19:38:53 -06:00
committed by Jordan Woyak
parent 2a60fe0e7d
commit ddea4248d3
3 changed files with 286 additions and 259 deletions
+3 -2
View File
@@ -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);
}