From 4c3961d5dd51e0f61cdbd1bb2b691763ed8c8fdb Mon Sep 17 00:00:00 2001 From: Steveice10 Date: Sat, 4 Aug 2018 01:24:36 -0700 Subject: [PATCH] am: Correct ListDLCContentInfos index bounds. --- src/core/hle/service/am/am.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index a57c1e67c..d378da2d4 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -592,9 +592,10 @@ void Module::Interface::ListDLCContentInfos(Kernel::HLERequestContext& ctx) { u32 copied = 0; FileSys::TitleMetadata tmd; if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) { - copied = std::min(content_count, static_cast(tmd.GetContentCount())); + u32 end_index = + std::min(start_index + content_count, static_cast(tmd.GetContentCount())); std::size_t write_offset = 0; - for (u32 i = start_index; i < start_index + copied; i++) { + for (u32 i = start_index; i < end_index; i++) { std::shared_ptr romfs_file; u64 romfs_offset = 0; @@ -612,6 +613,7 @@ void Module::Interface::ListDLCContentInfos(Kernel::HLERequestContext& ctx) { content_info_out.Write(&content_info, write_offset, sizeof(ContentInfo)); write_offset += sizeof(ContentInfo); + copied++; } }