summaryrefslogtreecommitdiff
path: root/src/modules/m_cgiirc.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-03 21:43:17 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-03 21:43:17 +0000
commitced8a722ae62567a708e82f0b72649a5c9399c40 (patch)
tree8c3c58cd32002b1aa2184ce64ad16b68e2fca870 /src/modules/m_cgiirc.cpp
parent56c1f7d40a3b1625893c8b0406ec709926f44b1c (diff)
Don't use hosts more than 64 characters long from CGI:IRC
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12368 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cgiirc.cpp')
-rw-r--r--src/modules/m_cgiirc.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 45447148b..27309e677 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -117,8 +117,10 @@ class CGIResolver : public Resolver
if (notify)
ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", them->nick.c_str(), them->host.c_str(), result.c_str(), typ.c_str());
- them->host.assign(result,0, 64);
- them->dhost.assign(result, 0, 64);
+ if (result.length() > 64)
+ return;
+ them->host = result;
+ them->dhost = result;
them->InvalidateCache();
them->CheckLines(true);
}
@@ -254,12 +256,11 @@ public:
{
std::string *webirc_hostname = cmd.webirc_hostname.get(user);
std::string *webirc_ip = cmd.webirc_ip.get(user);
- if (webirc_hostname)
+ if (webirc_hostname && webirc_hostname->length() < 64)
{
- user->host.assign(*webirc_hostname, 0, 64);
- user->dhost.assign(*webirc_hostname, 0, 64);
+ user->host = *webirc_hostname;
+ user->dhost = *webirc_hostname;
user->InvalidateCache();
- cmd.webirc_hostname.unset(user);
}
if (webirc_ip)
{
@@ -273,6 +274,7 @@ public:
user->CheckClass();
user->CheckLines(true);
}
+ cmd.webirc_hostname.unset(user);
}
bool CheckPass(LocalUser* user)
@@ -281,8 +283,8 @@ public:
{
cmd.realhost.set(user, user->host);
cmd.realip.set(user, user->GetIPString());
- user->host.assign(user->password, 0, 64);
- user->dhost.assign(user->password, 0, 64);
+ user->host = user->password;
+ user->dhost = user->password;
user->InvalidateCache();
ServerInstance->Users->RemoveCloneCounts(user);
@@ -363,7 +365,7 @@ public:
bool IsValidHost(const std::string &host)
{
- if(!host.size())
+ if(!host.size() || host.size() > 64)
return false;
for(unsigned int i = 0; i < host.size(); i++)