[PATCH v2 01/21] mime-node: handle decrypt_result more safely
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Thu Nov 30 00:59:26 PST 2017
If (for whatever reason) we don't get a decrypt_result back, or it's
not structured the way we expect it to be, we shouldn't choke on it.
---
mime-node.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/mime-node.c b/mime-node.c
index e1aca969..7c8b2602 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -214,13 +214,15 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
node->decrypt_success = true;
node->verify_attempted = true;
- /* This may be NULL if the part is not signed. */
- node->sig_list = g_mime_decrypt_result_get_signatures (decrypt_result);
- if (node->sig_list) {
- g_object_ref (node->sig_list);
- set_signature_list_destructor (node);
+ if (decrypt_result) {
+ /* This may be NULL if the part is not signed. */
+ node->sig_list = g_mime_decrypt_result_get_signatures (decrypt_result);
+ if (node->sig_list) {
+ g_object_ref (node->sig_list);
+ set_signature_list_destructor (node);
+ }
+ g_object_unref (decrypt_result);
}
- g_object_unref (decrypt_result);
DONE:
if (err)
--
2.15.0
More information about the notmuch
mailing list