summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-04-19 11:47:22 +0200
committerLéo Lam <leo@innovatetechnologi.es>2018-04-20 00:02:32 +0200
commit4c47417a0e3328854ab6bdea09e284eb8ef01ca2 (patch)
tree5a261c3159ad2a9b86feeddff7b09770c3b6317b /Source/Core
parenta500347345136b2fbc3535da27af2f81ac808a0b (diff)
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)`).
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IOS/FS/FileSystemProxy.cpp2
1 files changed, 2 insertions, 0 deletions
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<u32>(list->size())), file_count_address);
return GetFSReply(IPC_SUCCESS);
}