diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c575dc478c..919a129620 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -701,11 +701,21 @@ void ListDataTitleTicketInfos(Service::Interface* self) { ticket_count, title_id, start_index, ticket_info_out); } -void GetNumContentInfos(Service::Interface* self) { +void GetDLCContentInfoCount(Service::Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1001, 3, 0); // 0x100100C0 auto media_type = static_cast(rp.Pop()); u64 title_id = rp.Pop(); + // Validate that only DLC TIDs are passed in + u32 tid_high = static_cast(title_id >> 32); + if (tid_high != TID_HIGH_DLC) { + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(ResultCode(ErrCodes::InvalidTID, ErrorModule::AM, ErrorSummary::InvalidArgument, + ErrorLevel::Usage)); + rb.Push(0); + return; + } + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); // No error diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 8a2887bcd5..04493d9433 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -22,6 +22,7 @@ namespace AM { namespace ErrCodes { enum { CIACurrentlyInstalling = 4, + InvalidTID = 31, EmptyCIA = 32, InvalidTIDInList = 60, InvalidCIAHeader = 104, @@ -204,7 +205,8 @@ void GetPatchTitleInfos(Service::Interface* self); void ListDataTitleTicketInfos(Service::Interface* self); /** - * AM::GetNumContentInfos service function + * AM::GetDLCContentInfoCount service function + * Explicitly checks that TID high value is 0004008C or an error is returned. * Inputs: * 0 : Command header (0x100100C0) * 1 : MediaType @@ -213,7 +215,7 @@ void ListDataTitleTicketInfos(Service::Interface* self); * 1 : Result, 0 on success, otherwise error code * 2 : Number of content infos plus one */ -void GetNumContentInfos(Service::Interface* self); +void GetDLCContentInfoCount(Service::Interface* self); /** * AM::DeleteTicket service function diff --git a/src/core/hle/service/am/am_app.cpp b/src/core/hle/service/am/am_app.cpp index 4007e2d1c6..2be9582bb4 100644 --- a/src/core/hle/service/am/am_app.cpp +++ b/src/core/hle/service/am/am_app.cpp @@ -9,7 +9,7 @@ namespace Service { namespace AM { const Interface::FunctionInfo FunctionTable[] = { - {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, + {0x100100C0, GetDLCContentInfoCount, "GetDLCContentInfoCount"}, {0x10020104, FindDLCContentInfos, "FindDLCContentInfos"}, {0x10030142, ListDLCContentInfos, "ListDLCContentInfos"}, {0x10040102, DeleteContents, "DeleteContents"}, diff --git a/src/core/hle/service/am/am_sys.cpp b/src/core/hle/service/am/am_sys.cpp index 921221f396..a809ef4caa 100644 --- a/src/core/hle/service/am/am_sys.cpp +++ b/src/core/hle/service/am/am_sys.cpp @@ -54,7 +54,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x002B0142, nullptr, "ListExistingContentInfosSystem"}, {0x002C0084, nullptr, "GetProgramInfosIgnorePlatform"}, {0x002D00C0, CheckContentRightsIgnorePlatform, "CheckContentRightsIgnorePlatform"}, - {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, + {0x100100C0, GetDLCContentInfoCount, "GetDLCContentInfoCount"}, {0x10020104, FindDLCContentInfos, "FindDLCContentInfos"}, {0x10030142, ListDLCContentInfos, "ListDLCContentInfos"}, {0x10040102, DeleteContents, "DeleteContents"},