From 00aba94b98b1369d604f233fcd6a9dbbc233f3bb Mon Sep 17 00:00:00 2001 From: Gliniak Date: Thu, 5 Jan 2023 21:02:55 +0100 Subject: [PATCH] [NET] NetDll___WSAFDIsSet: Fixed incorrect endianness of fd_count Plus: limit it to 64 entries Thanks to Bo98 for pointing that out --- src/xenia/kernel/xam/xam_net.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xenia/kernel/xam/xam_net.cc b/src/xenia/kernel/xam/xam_net.cc index a331f139d..c208198cd 100644 --- a/src/xenia/kernel/xam/xam_net.cc +++ b/src/xenia/kernel/xam/xam_net.cc @@ -1017,7 +1017,9 @@ DECLARE_XAM_EXPORT1(NetDll_sendto, kNetworking, kImplemented); dword_result_t NetDll___WSAFDIsSet_entry(dword_t socket_handle, pointer_t fd_set) { - for (uint32_t i = 0; i < fd_set->fd_count.value; i++) { + const uint8_t max_fd_count = + std::min((uint32_t)fd_set->fd_count, uint32_t(64)); + for (uint8_t i = 0; i < max_fd_count; i++) { if (fd_set->fd_array[i] == socket_handle) { return 1; }