From: Attila Molnar Date: Tue, 8 Dec 2015 15:32:50 +0000 (+0100) Subject: Strip all control codes except \001 in InspIRCd::StripColor() X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=5b5590f09599c3fca1fd2c2ed9a6908cdd201597;p=user%2Fhenk%2Fcode%2Finspircd.git Strip all control codes except \001 in InspIRCd::StripColor() Fixes issue #1100 reported by @uecasm --- diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index dddd6b91f..aef45106c 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -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. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# diff --git a/include/inspircd.h b/include/inspircd.h index d41d2919b..91b70fbd8 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -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); diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 78d272b5f..6217eb20b 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -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;