From 65a555e82b3d04d1992f53df9a7f5ca8761fb4c4 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 9 Jul 2017 20:53:04 +0200 Subject: [PATCH] [Network] Don't send packets to invalid addresses --- src/Components/Modules/Network.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Modules/Network.cpp b/src/Components/Modules/Network.cpp index d60bb46c..d0507922 100644 --- a/src/Components/Modules/Network.cpp +++ b/src/Components/Modules/Network.cpp @@ -121,7 +121,7 @@ namespace Components } bool Network::Address::isValid() { - return (this->getType() != Game::netadrtype_t::NA_BAD); + return (this->getType() != Game::netadrtype_t::NA_BAD && this->getType() >= Game::netadrtype_t::NA_BOT && this->getType() <= Game::netadrtype_t::NA_IP); } void Network::Handle(std::string packet, Utils::Slot callback) { @@ -153,6 +153,8 @@ namespace Components void Network::SendRaw(Game::netsrc_t type, Network::Address target, std::string data) { + if (!target.isValid()) return; + // NET_OutOfBandData doesn't seem to work properly //Game::NET_OutOfBandData(type, *target.Get(), data.data(), data.size()); Game::Sys_SendPacket(type, data.size(), data.data(), *target.get());