diff --git a/src/client/component/security.cpp b/src/client/component/security.cpp new file mode 100644 index 00000000..83e6dc97 --- /dev/null +++ b/src/client/component/security.cpp @@ -0,0 +1,37 @@ +#include +#include "loader/component_loader.hpp" + +#include "game/game.hpp" + +#include + +namespace security +{ + namespace + { + void set_cached_playerdata_stub(const int localclient, const int index1, const int index2) + { + if (index1 >= 0 && index1 < 18 && index2 >= 0 && index2 < 42) + { + utils::hook::invoke(0x61A9D_b, localclient, index1, index2); + } + } + } + + class component final : public component_interface + { + public: + void post_unpack() override + { + if (game::environment::is_sp()) + { + return; + } + + // Patch vulnerability in PlayerCards_SetCachedPlayerData + utils::hook::call(0xF4632_b, set_cached_playerdata_stub); + } + }; +} + +REGISTER_COMPONENT(security::component)