mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Utility: Check request sizes like the firmware
InitStart sizes: Netconf and NpSignin accepted any size, then wrote common.size bytes back from a 64-68 byte host struct, copying host memory into PSP RAM. GamedataInstall looked for install files before checking the size, and the HtmlViewer read options before checking the whole request was in memory. All the dialogs now check the address, then the sizes sceUtility_Driver accepts (utility/dialog/sizes), before anything else, as the firmware does (a bad address is INVALID_ADDRESS), and write back no more than the struct. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
9e69c1f9aa
commit
6dffcc91d2
11 files changed
+74
-80
No files matched your search
@@ -66,22 +66,12 @@ int PSPScreenshotDialog::Init(u32 paramAddr) {
|
||||
return SCE_ERROR_UTILITY_INVALID_STATUS;
|
||||
}
|
||||
|
||||
const int check = CheckRequest(paramAddr, { SCE_UTILITY_SCREENSHOTDIALOG_SIZE_V1, SCE_UTILITY_SCREENSHOTDIALOG_SIZE_V2, SCE_UTILITY_SCREENSHOTDIALOG_SIZE_V3 });
|
||||
if (check < 0) {
|
||||
ERROR_LOG(Log::HLE, "sceUtilityScreenshotInitStart(%08x): bad request: %08x", paramAddr, check);
|
||||
return check;
|
||||
}
|
||||
params_ = PSPPointer<SceUtilityScreenshotParams>::Create(paramAddr);
|
||||
if (!params_.IsValid()) {
|
||||
ERROR_LOG_REPORT(Log::HLE, "sceUtilityScreenshotInitStart(%08x): invalid pointer", paramAddr);
|
||||
return SCE_KERNEL_ERROR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
switch ((u32)params_->base.size) {
|
||||
case SCE_UTILITY_SCREENSHOTDIALOG_SIZE_V1:
|
||||
case SCE_UTILITY_SCREENSHOTDIALOG_SIZE_V2:
|
||||
case SCE_UTILITY_SCREENSHOTDIALOG_SIZE_V3:
|
||||
break;
|
||||
|
||||
default:
|
||||
ERROR_LOG_REPORT(Log::HLE, "sceUtilityScreenshotInitStart(%08x): invalid size %d", paramAddr, (u32)params_->base.size);
|
||||
return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE;
|
||||
}
|
||||
|
||||
mode = params_->mode;
|
||||
ChangeStatus(SCE_UTILITY_STATUS_INITIALIZE, 0);
|
||||
|
||||
Reference in new issue
Block a user