From: Chris Porter Date: Sat, 12 Jul 2008 03:00:35 +0000 (+0100) Subject: Add maximum line lengths. X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/commitdiff_plain/341581c49a6b5b15f4bebea29011c066016dc75b Add maximum line lengths. --- diff --git a/config.py.example b/config.py.example index f42409a..05f0e25 100644 --- a/config.py.example +++ b/config.py.example @@ -5,3 +5,4 @@ UPDATE_FREQ = 0.5 MAXBUFLEN = 10000 MAXSUBSCRIPTIONS = 3 REALNAME = "http://moo.com/" +MAXLINELEN = 600 diff --git a/qwebirc/ajaxengine.py b/qwebirc/ajaxengine.py index 84b4a09..ff6bd8e 100644 --- a/qwebirc/ajaxengine.py +++ b/qwebirc/ajaxengine.py @@ -181,6 +181,10 @@ class AJAXEngine(resource.Resource): except UnicodeDecodeError: decoded = command.decode("iso-8859-1", "ignore") + if len(decoded) > config.MAXLINELEN: + session.disconnect() + return [False, "Line too long"] + try: session.push(decoded) except AttributeError: # occurs when we haven't noticed an error