Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9270 from leoetlino/dtm-gameid-null
Core/Movie: Fix a likely out-of-bounds read for PanicAlertT
  • Loading branch information
lioncash committed Nov 21, 2020
2 parents 608dd6a + 83b9fef commit 41b79a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Core/Movie.cpp
Expand Up @@ -227,10 +227,10 @@ void Init(const BootParameters& boot)
ReadHeader();
std::thread md5thread(CheckMD5);
md5thread.detach();
if (strncmp(tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6))
if (tmpHeader.GetGameID() == SConfig::GetInstance().GetGameID())
{
PanicAlertFmtT("The recorded game ({0}) is not the same as the selected game ({1})",
tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID());
tmpHeader.GetGameID(), SConfig::GetInstance().GetGameID());
EndPlayInput(false);
}
}
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Core/Movie.h
Expand Up @@ -8,6 +8,7 @@
#include <functional>
#include <optional>
#include <string>
#include <string_view>

#include "Common/CommonTypes.h"

Expand Down Expand Up @@ -63,6 +64,8 @@ static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes")
#pragma pack(push, 1)
struct DTMHeader
{
std::string_view GetGameID() const { return {gameID.data(), gameID.size()}; }

std::array<u8, 4> filetype; // Unique Identifier (always "DTM"0x1A)

std::array<char, 6> gameID; // The Game ID
Expand Down

0 comments on commit 41b79a6

Please sign in to comment.