mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
State: Don't use memcpy and memcmp with strings
This commit is contained in:
parent
5a1729877e
commit
2b0bdc361f
@ -343,7 +343,7 @@ static void CompressAndDumpState(CompressAndDumpState_args save_args)
|
||||
|
||||
// Setting up the header
|
||||
StateHeader header;
|
||||
memcpy(header.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6);
|
||||
strncpy((char*)header.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6);
|
||||
header.size = g_use_compression ? (u32)buffer_size : 0;
|
||||
header.time = Common::Timer::GetDoubleTime();
|
||||
|
||||
@ -474,7 +474,7 @@ static void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_
|
||||
StateHeader header;
|
||||
f.ReadArray(&header, 1);
|
||||
|
||||
if (memcmp(SConfig::GetInstance().GetUniqueID().c_str(), header.gameID, 6))
|
||||
if (strncmp(SConfig::GetInstance().GetUniqueID().c_str(), (char*)header.gameID, 6))
|
||||
{
|
||||
Core::DisplayMessage(StringFromFormat("State belongs to a different game (ID %.*s)",
|
||||
6, header.gameID), 2000);
|
||||
|
Loading…
Reference in New Issue
Block a user