From aa5a97bfd618d26fe5c082d57557cea20cbe342d Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 26 Sep 2014 20:58:55 +0200 Subject: Don't try to set a mode in Channel::SetDefaultModes() if it needs a parameter but does not have one Thanks to @docwhat for helping to track this down, fixes issue #924 --- src/channels.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index 6c9bd7c85..9eee987f1 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -206,6 +206,9 @@ void Channel::SetDefaultModes() else parameter.clear(); + if ((mode->GetNumParams(true)) && (parameter.empty())) + continue; + mode->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, this, parameter, true); } } -- cgit v1.3.1-10-gc9f91 From 4343bbb67aea2c2a23844bca1dab6488cd1402f1 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 26 Sep 2014 21:07:24 +0200 Subject: Reject parameters that begin with a colon in Channel::SetDefaultModes() --- src/channels.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index 9eee987f1..9f1eafd0c 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -202,7 +202,12 @@ void Channel::SetDefaultModes() if (mode) { if (mode->GetNumParams(true)) + { list.GetToken(parameter); + // If the parameter begins with a ':' then it's invalid + if (parameter.c_str()[0] == ':') + continue; + } else parameter.clear(); -- cgit v1.3.1-10-gc9f91