From 4c47417a0e3328854ab6bdea09e284eb8ef01ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 19 Apr 2018 11:47:22 +0200 Subject: [PATCH] IOS/FS: Fix ReadDir returning wrong number of entries ReadDir should always write the actual number of entries in the directory list (`min(max_count, number_of_entries_on_nand)`). --- Source/Core/Core/IOS/FS/FileSystemProxy.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/Core/IOS/FS/FileSystemProxy.cpp b/Source/Core/Core/IOS/FS/FileSystemProxy.cpp index fbabef74cb..2301cf7cad 100644 --- a/Source/Core/Core/IOS/FS/FileSystemProxy.cpp +++ b/Source/Core/Core/IOS/FS/FileSystemProxy.cpp @@ -469,6 +469,8 @@ IPCCommandResult FS::ReadDirectory(const Handle& handle, const IOCtlVRequest& re Memory::Write_U8(0, file_list_address + 12); file_list_address += 13; } + // Write the actual number of entries in the buffer. + Memory::Write_U32(std::min(max_count, static_cast(list->size())), file_count_address); return GetFSReply(IPC_SUCCESS); }