From 51fb269d0d6d2493af32ed0bcb7e7d1d27ccdb01 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 7 Jul 2017 20:05:10 -0700 Subject: [PATCH] IRCNetwork: don't attempt to send more than 510 bytes per message Some IRCds like ngIRCd will SQUIT you if you try to do so, though most just ignore this kind of overflow. --- classes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes.py b/classes.py index 72abec2..161da48 100644 --- a/classes.py +++ b/classes.py @@ -1347,7 +1347,7 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils): # Safeguard against newlines in input!! Otherwise, each line gets # treated as a separate command, which is particularly nasty. data = data.replace('\n', ' ') - encoded_data = data.encode(self.encoding, 'replace') + b"\n" + encoded_data = data.encode(self.encoding, 'replace')[:510] + b"\n" log.debug("(%s) -> %s", self.name, data)