mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Don't write more than the savedata buffer.
Fixes Numblast when there's savedata, probably others. Could use more testing.
This commit is contained in:
parent
ff0eb6eb62
commit
9fb64183e6
1 changed files with 3 additions and 2 deletions
|
@ -527,7 +527,7 @@ bool SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &save
|
|||
if(DecryptSave(decryptMode, data_base, &saveSize, &align_len, ((param->key[0] != 0)?cryptKey:0)) == 0)
|
||||
{
|
||||
if (param->dataBuf.IsValid())
|
||||
memcpy(data_, data_base, saveSize);
|
||||
memcpy(data_, data_base, std::min(saveSize, (int)param->dataBufSize));
|
||||
saveDone = true;
|
||||
}
|
||||
delete[] data_base;
|
||||
|
@ -535,7 +535,8 @@ bool SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &save
|
|||
}
|
||||
if(!saveDone) // not crypted or decrypt fail
|
||||
{
|
||||
memcpy(data_, saveData, saveSize);
|
||||
if (param->dataBuf.IsValid())
|
||||
memcpy(data_, saveData, std::min(saveSize, (int)param->dataBufSize));
|
||||
}
|
||||
param->dataSize = (SceSize)saveSize;
|
||||
delete[] saveData;
|
||||
|
|
Loading…
Add table
Reference in a new issue