diff options
| author | JosJuice <josjuice@gmail.com> | 2026-02-23 20:59:46 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2026-02-24 21:36:02 +0100 |
| commit | 7b372db5593ddc92dd442e57170f13072b43ade8 (patch) | |
| tree | 5e883f44605691a4f3abfde3645589f2ceb0389e /Source/Core/DiscIO/VolumeDisc.cpp | |
| parent | 1d74321212e24b5709e20ca17710bc435882de45 (diff) | |
DiscIO: Only allow alphanumeric ASCII in game IDs
We often use game IDs in paths, so we should try to make sure path
traversal is impossible in game IDs. Admittedly, doing any kind of real
attack using the six bytes available in game IDs is unrealistic, but no
game ID should contain non-alphanumeric or non-ASCII characters anyway.
Might also fix https://bugs.dolphin-emu.org/issues/13982 by skipping
converting between encodings for game IDs.
Diffstat (limited to 'Source/Core/DiscIO/VolumeDisc.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeDisc.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/DiscIO/VolumeDisc.cpp b/Source/Core/DiscIO/VolumeDisc.cpp index ecbb4a9dc9..2ec71b9fe1 100644 --- a/Source/Core/DiscIO/VolumeDisc.cpp +++ b/Source/Core/DiscIO/VolumeDisc.cpp @@ -50,13 +50,13 @@ std::string VolumeDisc::GetGameID(const Partition& partition) const 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); + return FilterGameID(id); } if (!Read(0, sizeof(id), reinterpret_cast<u8*>(id), partition)) return std::string(); - return DecodeString(id); + return FilterGameID(id); } Country VolumeDisc::GetCountry(const Partition& partition) const @@ -126,9 +126,9 @@ std::string VolumeDisc::GetMakerID(const Partition& partition) const { case 'S': // SEGA CORPORATION case 'H': // Hitmaker co,ltd - return DecodeString("6E"); + return "6E"; case 'N': // NAMCO CORPORATION - return DecodeString("82"); + return "82"; default: break; } @@ -138,7 +138,7 @@ std::string VolumeDisc::GetMakerID(const Partition& partition) const if (!Read(0x4, sizeof(maker_id), reinterpret_cast<u8*>(&maker_id), partition)) return std::string(); - return DecodeString(maker_id); + return FilterGameID(maker_id); } std::optional<u16> VolumeDisc::GetRevision(const Partition& partition) const |
