Strip all control codes except \001 in InspIRCd::StripColor()

Fixes issue #1100 reported by @uecasm
This commit is contained in:
Attila Molnar 2015-12-08 16:32:50 +01:00
parent 306ef5e3ea
commit 5b5590f095
3 changed files with 5 additions and 4 deletions

View File

@ -1863,8 +1863,8 @@
# http://wiki.inspircd.org/Modules/ssl_openssl #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Strip color module: Adds channel mode +S that strips mIRC color
# codes from all messages sent to the channel.
# Strip color module: Adds channel mode +S that strips color codes and
# all control codes except CTCP from all messages sent to the channel.
#<module name="stripcolor">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

View File

@ -546,7 +546,7 @@ class CoreExport InspIRCd
*/
static bool IsValidMask(const std::string& mask);
/** Strips all color codes from the given string
/** Strips all color and control codes except 001 from the given string
* @param sentence The string to strip from
*/
static void StripColor(std::string &sentence);

View File

@ -127,7 +127,8 @@ void InspIRCd::StripColor(std::string &sentence)
else
seq = 0;
if (seq || ((*i == 2) || (*i == 15) || (*i == 22) || (*i == 21) || (*i == 31)))
// Strip all control codes too except \001 for CTCP
if (seq || ((*i < 32) && (*i != 1)))
i = sentence.erase(i);
else
++i;