diff options
-rw-r--r-- | include/builtinmodes.h | 1 | ||||
-rw-r--r-- | src/modes/cmode_k.cpp | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/builtinmodes.h b/include/builtinmodes.h index 96838ce5e..62ccaf62d 100644 --- a/include/builtinmodes.h +++ b/include/builtinmodes.h @@ -39,6 +39,7 @@ class ModeChannelBan : public ListModeBase */ class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt> { + static const std::string::size_type maxkeylen = 32; public: ModeChannelKey(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index 6738c046e..980b3215a 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -52,7 +52,8 @@ ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, s channel->SetMode(this, adding); if (adding) { - parameter.erase(32); + if (parameter.length() > maxkeylen) + parameter.erase(maxkeylen); ext.set(channel, parameter); } else |