From 13926c79c7cab56042757a2bbe0eba1657c6e8c9 Mon Sep 17 00:00:00 2001 From: RipleyTom Date: Fri, 5 Jan 2024 16:34:29 +0100 Subject: [PATCH] Fix sceNpBasicSetPresence when data is nullptr and size is 0 --- rpcs3/Emu/Cell/Modules/sceNp.cpp | 6 +++--- rpcs3/Emu/NP/np_handler.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/sceNp.cpp b/rpcs3/Emu/Cell/Modules/sceNp.cpp index 83b90d0d9ebf..68f174837d2e 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp.cpp @@ -846,7 +846,7 @@ error_code sceNpBasicSetPresence(vm::cptr data, u32 size) } // Not checked by API - ensure(data); + ensure(data || !size, "Access violation"); std::vector pr_data(data.get_ptr(), data.get_ptr() + size); nph.set_presence(std::nullopt, pr_data); @@ -876,7 +876,7 @@ error_code sceNpBasicSetPresenceDetails(vm::cptr pres } // Not checked by API - ensure(pres); + ensure(pres, "Access violation"); if (pres->size > SCE_NP_BASIC_MAX_PRESENCE_SIZE) { @@ -923,7 +923,7 @@ error_code sceNpBasicSetPresenceDetails2(vm::cptr pr } // Not checked by API - ensure(pres); + ensure(pres, "Access violation"); if (pres->size > SCE_NP_BASIC_MAX_PRESENCE_SIZE) { diff --git a/rpcs3/Emu/NP/np_handler.cpp b/rpcs3/Emu/NP/np_handler.cpp index 457e60ab86aa..9e62704e67bb 100644 --- a/rpcs3/Emu/NP/np_handler.cpp +++ b/rpcs3/Emu/NP/np_handler.cpp @@ -823,8 +823,8 @@ namespace np for (auto& [npid, pr_info] : current_presences) { - // Only communicates info about online users with presence - if (!pr_info.online || pr_info.pr_com_id.data[0] == 0) + // Only communicates info about online users + if (!pr_info.online) { continue; }