Merge pull request #3921 from B3n30/fixGetStartupArgument

Fix parameter_size in APT::GetStartupArgument
This commit is contained in:
Weiyi Wang 2018-07-11 11:41:04 +03:00 committed by GitHub
commit edcea90948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -620,12 +620,14 @@ void Module::Interface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
u32 parameter_size = rp.Pop<u32>(); u32 parameter_size = rp.Pop<u32>();
StartupArgumentType startup_argument_type = static_cast<StartupArgumentType>(rp.Pop<u8>()); StartupArgumentType startup_argument_type = static_cast<StartupArgumentType>(rp.Pop<u8>());
if (parameter_size >= 0x300) { const u32 max_parameter_size{0x1000};
LOG_ERROR(
Service_APT, if (parameter_size > max_parameter_size) {
"Parameter size is outside the valid range (capped to 0x300): parameter_size={:#010X}", LOG_ERROR(Service_APT,
parameter_size); "Parameter size is outside the valid range (capped to {:#010X}): "
return; "parameter_size={:#010X}",
max_parameter_size, parameter_size);
parameter_size = max_parameter_size;
} }
std::vector<u8> parameter(parameter_size, 0); std::vector<u8> parameter(parameter_size, 0);