From 86dc3440834c02bc91b38fb5e87106d423af8a73 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 1 Oct 2012 00:40:50 -0400 Subject: [PATCH] Reject malformed URls with no channel. --- irkerd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/irkerd b/irkerd index 8172edf..a89d78c 100755 --- a/irkerd +++ b/irkerd @@ -240,6 +240,9 @@ class Target(): self.servername = irchost self.channel = parsed.path.lstrip('/') self.port = int(ircport) + def valid(self): + "Both components must be present for a valid target." + self.servername and self.channel def server(self): "Return a hashable tuple representing the destination server." return (self.servername, self.port) @@ -351,6 +354,8 @@ class Irker: self.logerr("malformed request - unexpected type: %s" % repr(request)) else: target = Target(url) + if not target.valid(): + return if target.server() not in self.servers: self.servers[target.server()] = Dispatcher(self, target.servername, target.port) self.servers[target.server()].dispatch(target.channel, message) -- 2.26.2