SI_DeviceAMBaseboard: Add missing bounds checks
VolumeDisc: Fix Triforce's GetGameID memcpy by checking MakerID's size
This commit is contained in:
1 parent
0acb6145f7
commit
cbc7c2d385
3 files changed
+286
-259
No files matched your search
@@ -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