From 3fbc05242c87fee6a401b94877f7eda865d672bc Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 13 Aug 2017 08:32:09 +0100 Subject: m_sethost: use length() instead of counting in the loop. --- src/modules/m_sethost.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 75dbe1c6a..a5f36da65 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -36,8 +36,7 @@ class CommandSethost : public Command CmdResult Handle (const std::vector& parameters, User *user) { - size_t len = 0; - for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++, len++) + for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++) { if (!hostmap[(const unsigned char)*x]) { @@ -46,7 +45,7 @@ class CommandSethost : public Command } } - if (len > ServerInstance->Config->Limits.MaxHost) + if (parameters[0].length() > ServerInstance->Config->Limits.MaxHost) { user->WriteNotice("*** SETHOST: Host too long"); return CMD_FAILURE; -- cgit v1.2.3