summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-05-12 09:56:40 +0200
committerAnton Khirnov <anton@khirnov.net>2020-05-12 09:56:40 +0200
commit3ece965de9473769d55f8387df4c1c2dc961ba48 (patch)
treef8304b77ed175fe8db199757d11b3cadb8624c52
parent287d50705266a05214f14fb276c3496a4c42e87f (diff)
sshban: handle invalid input
-rwxr-xr-xsshban.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/sshban.py b/sshban.py
index 102f4a3..11b5d4b 100755
--- a/sshban.py
+++ b/sshban.py
@@ -240,7 +240,11 @@ with open(fifofd) as fifo:
if len(line) == 0:
continue
- ts, msg = line.rstrip().split(maxsplit = 1)
+ parts = line.rstrip().split(maxsplit = 1)
+ if len(parts) != 2:
+ logger.error('Invalid log line: %s' % line)
+ continue
+ ts, msg = parts
logger.debug('processing message: %s' % msg)
res = process_msg(ts, msg)