From d05917222d248050f6d5b029e733fe43181efa1c Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 20 Sep 2016 06:58:04 -0700 Subject: [PATCH] relay: clobber colour codes in hosts (cherry picked from commit b467da13b12b87b972714d89129e7e93f11e7137) --- plugins/relay.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/relay.py b/plugins/relay.py index 1d9e410..6174f25 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -182,6 +182,15 @@ def normalizeHost(irc, host): if irc.protoname not in ('inspircd', 'ts6', 'clientbot', 'nefarious'): # UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames host = host.replace('/', '.') + host = host.replace('\x03', '') # Strip colours + host = host.replace('\x02', '') # Strip bold + host = host.replace('\x1f', '') # Strip underline + host = host.replace('\x1d', '') # Strip italic + host = host.replace('\x0f', '') # Strip color reset + host = host.replace('\x16', '') # Strip reverse color + # And no, I'm not supporting colours in hosts. Screw your IRCd-breaking patches if you think + # this is cool. -GL + return host[:63] # Limit hosts to 63 chars for best compatibility def loadDB():