From 21da47f3e5b2abd7f2aadda3140859900b9e97e4 Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:15:33 -0400 Subject: [PATCH] Fixed gamer_handle_serialize/deserialize using the wrong sizes. (#2886) --- src/hooks/protections/receive_net_message.cpp | 4 ++-- src/util/chat.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 37b199af..4860435c 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -19,11 +19,11 @@ inline void gamer_handle_deserialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf) { - if ((hnd.m_platform = buf.Read(sizeof(hnd.m_platform))) != rage::rlPlatforms::PC) + if ((hnd.m_platform = buf.Read(sizeof(hnd.m_platform) * 8)) != rage::rlPlatforms::PC) return; buf.ReadPeerId(&hnd.m_rockstar_id); - hnd.m_padding = buf.Read(sizeof(hnd.m_padding)); + hnd.m_padding = buf.Read(sizeof(hnd.m_padding) * 8); } inline bool is_kick_instruction(rage::datBitBuffer& buffer) diff --git a/src/util/chat.hpp b/src/util/chat.hpp index 23eb53c0..a2997856 100644 --- a/src/util/chat.hpp +++ b/src/util/chat.hpp @@ -18,11 +18,11 @@ namespace { static void gamer_handle_serialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf) { - buf.Write(hnd.m_platform, sizeof(hnd.m_platform)); + buf.Write(hnd.m_platform, sizeof(hnd.m_platform) * 8); if (hnd.m_platform == rage::rlPlatforms::PC) { - buf.WriteQWord(hnd.m_rockstar_id, sizeof(hnd.m_rockstar_id)); - buf.Write(hnd.m_padding, sizeof(hnd.m_padding)); + buf.WriteQWord(hnd.m_rockstar_id, sizeof(hnd.m_rockstar_id) * 8); + buf.Write(hnd.m_padding, sizeof(hnd.m_padding) * 8); } }