[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()
|
Network::Network()
|
||||||
{
|
{
|
||||||
AssertSize(Game::netadr_t, 20);
|
AssertSize(Game::netadr_t, 20);
|
||||||
@ -372,6 +378,9 @@ namespace Components
|
|||||||
// Install packet deploy hook
|
// Install packet deploy hook
|
||||||
Utils::Hook::RedirectJump(0x5AA713, Network::DeployPacketStub);
|
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::Handle("resolveAddress", [](Address address, const std::string& /*data*/)
|
||||||
{
|
{
|
||||||
Network::SendRaw(address, address.getString());
|
Network::SendRaw(address, address.getString());
|
||||||
|
@ -88,6 +88,7 @@ namespace Components
|
|||||||
static void NetworkStartStub();
|
static void NetworkStartStub();
|
||||||
|
|
||||||
static void PacketErrorCheck();
|
static void PacketErrorCheck();
|
||||||
|
static void NET_DeferPacketToClientStub(Game::netadr_t* from, Game::msg_t* msg);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user