From 2ddb62319803f6a3f3246a52b4e009d9ae1daaed Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 18 Dec 2022 17:51:35 +0000 Subject: Use in_port_t instead of int/unsigned int/long. --- src/users.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index 1e95d3310..3ab397a49 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -523,7 +523,7 @@ void LocalUser::FullConnect() FOREACH_MOD(OnPostConnect, (this)); - ServerInstance->SNO.WriteToSnoMask('c', "Client connecting on port %d (class %s): %s (%s) [%s\x0F]", + ServerInstance->SNO.WriteToSnoMask('c', "Client connecting on port %hu (class %s): %s (%s) [%s\x0F]", this->server_sa.port(), this->GetClass()->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str()); ServerInstance->Logs.Debug("BANCACHE", "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); @@ -1091,7 +1091,7 @@ void LocalUser::SetClass(const std::string& explicit_name) /* if it requires a port and our port doesn't match, fail */ if (!c->ports.empty() && !c->ports.count(this->server_sa.port())) { - ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the connection port (%d) is not any of %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the connection port (%hu) is not any of %s", c->GetName().c_str(), this->server_sa.port(), stdalgo::string::join(c->ports).c_str()); continue; } @@ -1206,7 +1206,10 @@ void ConnectClass::Configure(const std::string& classname, std::shared_ptrgetString("port"), false); while (long port = portrange.GetToken()) - ports.insert(static_cast(port)); + { + if (port > std::numeric_limits::min() && port <= std::numeric_limits::max()) + ports.insert(static_cast(port)); + } commandrate = tag->getUInt("commandrate", commandrate, 1); fakelag = tag->getBool("fakelag", fakelag); -- cgit v1.3.1-10-gc9f91