Reject input that doesn't parse to a dict.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 30 Sep 2012 01:59:09 +0000 (21:59 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 30 Sep 2012 01:59:09 +0000 (21:59 -0400)
irkerd

diff --git a/irkerd b/irkerd
index d249fca52de88af755d203be9507569c89f96a96..bdcd54e3a50d56a519824327e6c1b8bbb1365f0b 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -314,7 +314,9 @@ class Irker:
         "Perform a JSON relay request."
         try:
             request = json.loads(line.strip())
-            if "to" not in request or "privmsg" not in request:
+            if type(request) != type({}):
+                self.logerr("request in tot a JSON dictionary: %s" % repr(request))
+            elif "to" not in request or "privmsg" not in request:
                 self.logerr("malformed reqest - 'to' or 'privmsg' missing: %s" % repr(request))
             else:
                 channels = request['to']