Savedata: Return error when bufSize is too small.

Mirrors what a PSP does.
This commit is contained in:
Unknown W. Brackets 2018-08-11 16:36:28 -07:00
parent 718053e7fc
commit 42feade460

View File

@ -362,6 +362,10 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD
if (!param) {
return SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE;
}
if (param->dataSize > param->dataBufSize) {
ERROR_LOG_REPORT(SCEUTILITY, "Savedata buffer overflow: %d / %d", param->dataSize, param->dataBufSize);
return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS;
}
if (param->secureVersion > 3) {
ERROR_LOG_REPORT(SCEUTILITY, "Savedata version requested on save: %d", param->secureVersion);
return SCE_UTILITY_SAVEDATA_ERROR_SAVE_PARAM;