]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/u_listmode.h
Fix unsafe iteration in m_timedbans
[user/henk/code/inspircd.git] / src / modules / u_listmode.h
index 7e018e55845fc5e425da2a0cceada1d8fb43e752..c18ac0f71b92cc8fbb6aa14e902fd1a270f35b0f 100644 (file)
@@ -224,6 +224,12 @@ class ListModeBase : public ModeHandler
 
                if (adding)
                {
+                       if (tidy)
+                               ModeParser::CleanMask(parameter);
+
+                       if (parameter.length() > 250)
+                               return MODEACTION_DENY;
+
                        // If there was no list
                        if (!el)
                        {
@@ -232,10 +238,6 @@ class ListModeBase : public ModeHandler
                                extItem.set(channel, el);
                        }
 
-                       // Clean the mask up
-                       if (this->tidy)
-                               ModeParser::CleanMask(parameter);
-
                        // Check if the item already exists in the list
                        for (modelist::iterator it = el->begin(); it != el->end(); it++)
                        {
@@ -257,7 +259,7 @@ class ListModeBase : public ModeHandler
                                {
                                        // We have a pattern matching the channel...
                                        maxsize = el->size();
-                                       if (IS_LOCAL(source) || (maxsize < it->limit))
+                                       if (!IS_LOCAL(source) || (maxsize < it->limit))
                                        {
                                                /* Ok, it *could* be allowed, now give someone subclassing us
                                                 * a chance to validate the parameter.