mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
SI_DeviceAMBaseboard: Add missing bounds checks
VolumeDisc: Fix Triforce's GetGameID memcpy by checking MakerID's size
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user