From 66221de4b6cca64692c84eabfe0b81cabdbd00bc Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 14 Jan 2015 12:07:20 +0100 Subject: cmode_k Fix oversight in substr() conversion While at it, introduce a named constant for maximum key length --- src/modes/cmode_k.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/modes') 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 -- cgit v1.2.3