]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cgiirc.cpp
Fix TBAN not working if the banner is owner/protected
[user/henk/code/inspircd.git] / src / modules / m_cgiirc.cpp
index 45447148bcde234da90f29ed3708f7631eaf9c26..27309e677b51372e45e8e5448f086a159d7d3430 100644 (file)
@@ -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++)