Skip to content

Commit

Permalink
m_chghost: Fix incorrect length check pointed out by Thales
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel De Graaf committed Feb 26, 2012
1 parent 6ba5b6b commit 58f0b9d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/modules/m_chghost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class CommandChghost : public Command
{
const char* x = parameters[1].c_str();

if (parameters[1].length() > 63)
{
user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick.c_str());
return CMD_FAILURE;
}

for (; *x; x++)
{
if (!hostmap[(unsigned char)*x])
Expand All @@ -42,11 +48,6 @@ class CommandChghost : public Command
}
}

if ((parameters[1].c_str() - x) > 63)
{
user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick.c_str());
return CMD_FAILURE;
}
User* dest = ServerInstance->FindNick(parameters[0]);

if (!dest)
Expand Down

0 comments on commit 58f0b9d

Please sign in to comment.