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) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-25 12:50:41 -06:00
1 parent 9e69c1f9aa
commit 6dffcc91d2
11 files changed
+74 -80

No files matched your search

+5 -6
View File
@@ -31,16 +31,15 @@ int PSPPlaceholderDialog::Init(u32 paramAddr) {
if (ReadStatus() != SCE_UTILITY_STATUS_NONE) {
return SCE_ERROR_UTILITY_INVALID_STATUS;
}
// The request sizes a PSP accepts for GameSharing.
const int check = DialogType() == UtilityDialogType::GAMESHARING ? CheckRequest(paramAddr, { 0x50, 0x54, 0x64 }) : 0;
if (check < 0) {
return check;
}
if (!Memory::IsValidRange(paramAddr, sizeof(pspUtilityDialogCommon))) {
return SCE_KERNEL_ERROR_BAD_ARGUMENT;
}
params_ = paramAddr;
// The request sizes a PSP accepts for GameSharing.
const u32 size = params_->size;
if (DialogType() == UtilityDialogType::GAMESHARING && size != 0x50 && size != 0x54 && size != 0x64) {
params_ = 0;
return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE;
}
ChangeStatusInit(PLACEHOLDER_INIT_DELAY_US);
InitCommon();