fixed crash when receiving tampered encrypted msgs
authorAndrew Engelbrecht <sudoman@ninthfloor.org>
Sun, 19 Jul 2015 23:18:26 +0000 (19:18 -0400)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Mon, 7 Dec 2015 18:16:28 +0000 (13:16 -0500)
edward now shouldn't crash when receiving a corrupted gpg encryption
block.

edward

diff --git a/edward b/edward
index d0221492b4f44c03956cfa58001e12d9bc8ae987..cd585367bb5ef3199e4a32d5a9d4fd87f7b7b0e4 100755 (executable)
--- a/edward
+++ b/edward
@@ -222,7 +222,10 @@ def decrypt_block (msg_block, gpgme_ctx):
     block_b = io.BytesIO(msg_block.encode('ascii'))
     plain_b = io.BytesIO()
 
-    sigs = gpgme_ctx.decrypt_verify(block_b, plain_b)
+    try:
+        sigs = gpgme_ctx.decrypt_verify(block_b, plain_b)
+    except:
+        return ("",[])
 
     plaintext = plain_b.getvalue().decode('utf-8')
     return (plaintext, sigs)