From fed5180d1982e5c29097479eb9a87b7f94e86b31 Mon Sep 17 00:00:00 2001
From: Tim Abbott <tabbott@zulipchat.com>
Date: Wed, 10 May 2017 11:47:00 -0700
Subject: [PATCH] zephyr_mirror: Avoid transmitting null characters to server.

---
 bots/zephyr_mirror_backend.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py
index 31987f6d..cbb6c8a4 100755
--- a/bots/zephyr_mirror_backend.py
+++ b/bots/zephyr_mirror_backend.py
@@ -307,6 +307,8 @@ def parse_zephyr_body(zephyr_data, notice_format):
                     fields[0], fields[1], fields[2], fields[4], fields[3])
     except ValueError:
         (zsig, body) = ("", zephyr_data)
+    # Clean body of any null characters, since they're invalid in our protocol.
+    body = body.replace('\x00', '')
     return (zsig, body)
 
 def parse_crypt_table(zephyr_class, instance):