From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id B71106DE129E for ; Thu, 30 Nov 2017 01:00:17 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.015 X-Spam-Level: X-Spam-Status: No, score=-0.015 tagged_above=-999 required=5 tests=[AWL=-0.015] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SCAHSYqIupZu for ; Thu, 30 Nov 2017 01:00:13 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id CB0956DE0191 for ; Thu, 30 Nov 2017 00:59:59 -0800 (PST) Received: from fifthhorseman.net (ool-6c3a0662.static.optonline.net [108.58.6.98]) by che.mayfirst.org (Postfix) with ESMTPSA id 7FE3CF9AE for ; Thu, 30 Nov 2017 03:59:57 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id D27AF2079B; Thu, 30 Nov 2017 03:59:52 -0500 (EST) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v2 01/21] mime-node: handle decrypt_result more safely Date: Thu, 30 Nov 2017 03:59:26 -0500 Message-Id: <20171130085946.11332-2-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171130085946.11332-1-dkg@fifthhorseman.net> References: <20171130085946.11332-1-dkg@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 09:00:17 -0000 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