diff options
-rw-r--r-- | include/mode.h | 4 | ||||
-rw-r--r-- | src/listmode.cpp | 3 | ||||
-rw-r--r-- | src/mode.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_chanfilter.cpp | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/include/mode.h b/include/mode.h index 683f4b55b..b357de03d 100644 --- a/include/mode.h +++ b/include/mode.h @@ -544,8 +544,12 @@ class CoreExport ModeWatcher : public classbase class CoreExport ModeParser : public fakederef<ModeParser> { public: + /** The maximum number of modes which can be created. */ static const ModeHandler::Id MODEID_MAX = 64; + /** The maximum length of a mode parameter. */ + static const size_t MODE_PARAM_MAX = 250; + /** Type of the container that maps mode names to ModeHandlers */ typedef TR1NS::unordered_map<std::string, ModeHandler*, irc::insensitive, irc::StrHashComp> ModeHandlerMap; diff --git a/src/listmode.cpp b/src/listmode.cpp index 3d8221779..2a2515cd2 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -160,9 +160,6 @@ ModeAction ListModeBase::OnModeChange(User* source, User*, Channel* channel, std if (tidy) ModeParser::CleanMask(parameter); - if (parameter.length() > 250) - return MODEACTION_DENY; - // If there was no list if (!cd) { diff --git a/src/mode.cpp b/src/mode.cpp index 159474985..8b0d88607 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -249,9 +249,9 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Mode const bool needs_param = mh->NeedsParam(adding); std::string& parameter = mcitem.param; - // crop mode parameter size to 250 characters - if (parameter.length() > 250 && adding) - parameter.erase(250); + // crop mode parameter size to MODE_PARAM_MAX characters + if (parameter.length() > MODE_PARAM_MAX && adding) + parameter.erase(MODE_PARAM_MAX); ModResult MOD_RESULT; FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mh, parameter, adding)); diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index b2323176c..6131ab916 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -71,7 +71,7 @@ class ModuleChanFilter : public Module { ConfigTag* tag = ServerInstance->Config->ConfValue("chanfilter"); hidemask = tag->getBool("hidemask"); - cf.maxlen = tag->getUInt("maxlen", 35, 10, 100); + cf.maxlen = tag->getUInt("maxlen", 35, 10, ModeParser::MODE_PARAM_MAX); notifyuser = tag->getBool("notifyuser", true); cf.DoRehash(); } |