[RCon]: Use Hash only for IP (#807)

This commit is contained in:
Edo 2023-03-04 20:08:43 +00:00 committed by GitHub
parent cda6214d63
commit 6b8eabe513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,8 +88,7 @@ namespace Components
}
Network::Address address(params->get(1));
std::hash<Network::Address> hashFn;
const auto hash = hashFn(address);
const auto hash = std::hash<std::uint32_t>()(*reinterpret_cast<const std::uint32_t*>(&address.getIP().bytes[0]));
if (address.isValid() && std::ranges::find(RconAddresses, hash) == RconAddresses.end())
{
@ -200,8 +199,7 @@ namespace Components
Network::OnClientPacket("rcon", [](const Network::Address& address, [[maybe_unused]] const std::string& data)
{
std::hash<Network::Address> hashFn;
const auto hash = hashFn(address);
const auto hash = std::hash<std::uint32_t>()(*reinterpret_cast<const std::uint32_t*>(&address.getIP().bytes[0]));
if (!RconAddresses.empty() && std::ranges::find(RconAddresses, hash) == RconAddresses.end())
{
return;