[Network] Stops buffer overflow and crash at NET_DeferPacketToClient
- Fixes #17
This commit is contained in:
parent
f5aa4f91e0
commit
7aaa64f02d
@ -336,6 +336,12 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
void Network::NET_DeferPacketToClientStub(Game::netadr_t* from, Game::msg_t* msg)
|
||||
{
|
||||
if (msg->cursize > 0 && msg->cursize <= 1404)
|
||||
Game::NET_DeferPacketToClient(from, msg);
|
||||
}
|
||||
|
||||
Network::Network()
|
||||
{
|
||||
AssertSize(Game::netadr_t, 20);
|
||||
@ -372,6 +378,9 @@ namespace Components
|
||||
// Install packet deploy hook
|
||||
Utils::Hook::RedirectJump(0x5AA713, Network::DeployPacketStub);
|
||||
|
||||
// Fix packets causing buffer overflow
|
||||
Utils::Hook(0x6267E3, Network::NET_DeferPacketToClientStub, HOOK_CALL).install()->quick();
|
||||
|
||||
Network::Handle("resolveAddress", [](Address address, const std::string& /*data*/)
|
||||
{
|
||||
Network::SendRaw(address, address.getString());
|
||||
|
@ -58,7 +58,7 @@ namespace Components
|
||||
|
||||
static void Handle(const std::string& packet, Utils::Slot<Callback> callback);
|
||||
static void OnStart(Utils::Slot<CallbackRaw> callback);
|
||||
|
||||
|
||||
// Send quake-styled binary data
|
||||
static void Send(Address target, const std::string& data);
|
||||
static void Send(Game::netsrc_t type, Address target, const std::string& data);
|
||||
@ -88,6 +88,7 @@ namespace Components
|
||||
static void NetworkStartStub();
|
||||
|
||||
static void PacketErrorCheck();
|
||||
static void NET_DeferPacketToClientStub(Game::netadr_t* from, Game::msg_t* msg);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user