From 1bdb756b258e2acce1db96584b540f452370e1a8 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 25 Nov 2012 22:37:54 -0500 Subject: Restrict the length of kick reasons in cs_kick, cs_ban, and cs_akick --- modules/commands/cs_akick.cpp | 3 +++ modules/commands/cs_ban.cpp | 5 ++++- modules/commands/cs_kick.cpp | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index 29959bf32..9447b1aed 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -56,6 +56,9 @@ class CommandCSAKick : public Command NickCore *nc = NULL; const AutoKick *akick; + if (reason.length() > Config->CSReasonMax) + reason = reason.substr(0, Config->CSReasonMax); + if (!na) { Anope::string nick, user, host; diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index e857243f9..0fb65ecf6 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -27,7 +27,7 @@ class CommandCSBan : public Command { const Anope::string &chan = params[0]; const Anope::string &target = params[1]; - const Anope::string &reason = params.size() > 2 ? params[2] : "Requested"; + Anope::string reason = params.size() > 2 ? params[2] : "Requested"; ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) @@ -42,6 +42,9 @@ class CommandCSBan : public Command AccessGroup u_access = source.AccessFor(ci); + if (reason.length() > Config->CSReasonMax) + reason = reason.substr(0, Config->CSReasonMax); + if (!c) source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); else if (!u_access.HasPriv("BAN")) diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp index 4073f3fe8..e02ab5185 100644 --- a/modules/commands/cs_kick.cpp +++ b/modules/commands/cs_kick.cpp @@ -27,7 +27,7 @@ class CommandCSKick : public Command { const Anope::string &chan = params[0]; const Anope::string &target = params[1]; - const Anope::string &reason = params.size() > 2 ? params[2] : "Requested"; + Anope::string reason = params.size() > 2 ? params[2] : "Requested"; User *u = source.GetUser(); ChannelInfo *ci = ChannelInfo::Find(params[0]); @@ -45,6 +45,9 @@ class CommandCSKick : public Command return; } + if (reason.length() > Config->CSReasonMax) + reason = reason.substr(0, Config->CSReasonMax); + AccessGroup u_access = source.AccessFor(ci); if (!u_access.HasPriv("KICK")) -- cgit