citra-emu
/
citra
Archived
1
0
Fork 0

Services/APT: Use the right error codes in ReceiveParameter and GlanceParameter when the parameter doesn't exist.

This commit is contained in:
Subv 2017-07-21 13:02:40 -05:00
parent 5682608df7
commit 2dc720c355
1 changed files with 28 additions and 0 deletions

View File

@ -227,6 +227,20 @@ void ReceiveParameter(Service::Interface* self) {
"buffer_size is bigger than the size in the buffer descriptor (0x%08X > 0x%08zX)",
buffer_size, static_buff_size);
if (!next_parameter) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::Applet,
ErrorSummary::InvalidState, ErrorLevel::Status));
return;
}
if (next_parameter->destination_id != app_id) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status));
return;
}
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
rb.Push(RESULT_SUCCESS); // No error
@ -259,6 +273,20 @@ void GlanceParameter(Service::Interface* self) {
"buffer_size is bigger than the size in the buffer descriptor (0x%08X > 0x%08zX)",
buffer_size, static_buff_size);
if (!next_parameter) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::Applet,
ErrorSummary::InvalidState, ErrorLevel::Status));
return;
}
if (next_parameter->destination_id != app_id) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
ErrorLevel::Status));
return;
}
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
rb.Push(RESULT_SUCCESS); // No error
rb.Push(next_parameter->sender_id);