Merge pull request #687 from diamante0018/develop

symbols: fix this
This commit is contained in:
Edo 2023-04-19 12:00:34 +02:00 committed by GitHub
commit 244fd47089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 19 deletions

View File

@ -5,7 +5,6 @@
#include "command.hpp" #include "command.hpp"
#include "console.hpp" #include "console.hpp"
#include "network.hpp"
#include "scheduler.hpp" #include "scheduler.hpp"
#include "filesystem.hpp" #include "filesystem.hpp"
#include "fastfiles.hpp" #include "fastfiles.hpp"
@ -192,20 +191,6 @@ namespace patches
cmd_lui_notify_server_hook.invoke<void>(ent); cmd_lui_notify_server_hook.invoke<void>(ent);
} }
void sv_execute_client_message_stub(game::mp::client_t* client, game::msg_t* msg)
{
if (client->reliableAcknowledge < 0)
{
client->reliableAcknowledge = client->reliableSequence;
console::info("Negative reliableAcknowledge from %s - cl->reliableSequence is %i, reliableAcknowledge is %i\n",
client->name, client->reliableSequence, client->reliableAcknowledge);
network::send(client->header.remoteAddress, "error", "EXE_LOSTRELIABLECOMMANDS", '\n');
return;
}
reinterpret_cast<void(*)(game::mp::client_t*, game::msg_t*)>(0x14043AA90)(client, msg);
}
} }
class component final : public component_interface class component final : public component_interface
@ -335,9 +320,6 @@ namespace patches
// Prevent clients from ending the game as non host by sending 'end_game' lui notification // Prevent clients from ending the game as non host by sending 'end_game' lui notification
cmd_lui_notify_server_hook.create(0x1402E9390, cmd_lui_notify_server_stub); cmd_lui_notify_server_hook.create(0x1402E9390, cmd_lui_notify_server_stub);
// Prevent clients from sending invalid reliableAcknowledge
utils::hook::call(0x140443051, sv_execute_client_message_stub);
} }
static void patch_sp() static void patch_sp()

View File

@ -40,6 +40,19 @@ namespace security
a.popad64(); a.popad64();
a.jmp(0x14044DE51); a.jmp(0x14044DE51);
} }
void sv_execute_client_message_stub(game::mp::client_t* client, game::msg_t* msg)
{
if ((client->reliableSequence - client->reliableAcknowledge) < 0)
{
client->reliableAcknowledge = client->reliableSequence;
console::info("Negative reliableAcknowledge from %s - cl->reliableSequence is %i, reliableAcknowledge is %i\n",
client->name, client->reliableSequence, client->reliableAcknowledge);
return;
}
utils::hook::invoke<void>(0x14043AA90, client, msg);
}
} }
class component final : public component_interface class component final : public component_interface
@ -54,6 +67,9 @@ namespace security
// Patch entity overflow // Patch entity overflow
utils::hook::jump(0x14044DE3A, assemble(remap_cached_entities_stub), true); utils::hook::jump(0x14044DE3A, assemble(remap_cached_entities_stub), true);
// It is possible to make the server hang if left unchecked
utils::hook::call(0x140443051, sv_execute_client_message_stub);
} }
}; };
} }

View File

@ -52,7 +52,7 @@ namespace game
WEAK symbol<XAssetHeader(XAssetType type, const char *name, int allowCreateDefault)> DB_FindXAssetHeader{0x14017DCA0, 0x14026F0F0}; WEAK symbol<XAssetHeader(XAssetType type, const char *name, int allowCreateDefault)> DB_FindXAssetHeader{0x14017DCA0, 0x14026F0F0};
WEAK symbol<const char*(const XAsset* asset)> DB_GetXAssetName{0x140151C00, 0x140240DD0}; WEAK symbol<const char*(const XAsset* asset)> DB_GetXAssetName{0x140151C00, 0x140240DD0};
WEAK symbol<int(XAssetType type)> DB_GetXAssetTypeSize{0x140151C20, 0x140240DF0}; WEAK symbol<int(XAssetType type)> DB_GetXAssetTypeSize{0x140151C20, 0x140240DF0};
WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{0x1402F8B50, 0x140270F30}; WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{0x14017FB20, 0x140270F30};
WEAK symbol<int(XAssetType type, const char* name)> DB_XAssetExists{0x140182190, 0x1402750F0}; WEAK symbol<int(XAssetType type, const char* name)> DB_XAssetExists{0x140182190, 0x1402750F0};
WEAK symbol<int(XAssetType type, const char* name)> DB_IsXAssetDefault{0x14017EEF0, 0x140270320}; WEAK symbol<int(XAssetType type, const char* name)> DB_IsXAssetDefault{0x14017EEF0, 0x140270320};
WEAK symbol<int(const RawFile* rawfile)> DB_GetRawFileLen{0x14017E890, 0x14026FCC0}; WEAK symbol<int(const RawFile* rawfile)> DB_GetRawFileLen{0x14017E890, 0x14026FCC0};