mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix settings compare
It was just using a heuristic, comparing the first 24 bytes. Memory unsafety for configs that were shorter than 24 bytes.
This commit is contained in:
parent
a32aca50bf
commit
3a069093d7
|
@ -2594,7 +2594,7 @@ void CGameContext::OnMapChange(char *pNewMapName, int MapNameSize)
|
|||
SettingsIndex = pInfo->m_Settings;
|
||||
char *pMapSettings = (char *)Reader.GetData(SettingsIndex);
|
||||
int DataSize = Reader.GetUncompressedDataSize(SettingsIndex);
|
||||
if(DataSize == TotalLength && mem_comp(pSettings, pMapSettings, Size) == 0)
|
||||
if(DataSize == TotalLength && mem_comp(pSettings, pMapSettings, DataSize) == 0)
|
||||
{
|
||||
// Configs coincide, no need to update map.
|
||||
return;
|
||||
|
|
|
@ -70,7 +70,7 @@ void Process(IStorage *pStorage, const char *pMapName, const char *pConfigName)
|
|||
SettingsIndex = pInfo->m_Settings;
|
||||
char *pMapSettings = (char *)Reader.GetData(SettingsIndex);
|
||||
int DataSize = Reader.GetUncompressedDataSize(SettingsIndex);
|
||||
if(DataSize == TotalLength && mem_comp(pSettings, pMapSettings, Size) == 0)
|
||||
if(DataSize == TotalLength && mem_comp(pSettings, pMapSettings, DataSize) == 0)
|
||||
{
|
||||
dbg_msg("config_store", "configs coincide, not updating map");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue