Use existing error return values for two functions.
Since everything here is in the CLI, it seems better to print an error
message than silently ignore the error.
It turns out this does not really change the needed mitigation for
[1], but at least we are catching the problem closer to the origin,
and not creating arguably broken internal data structures.
[1] id:20260623074714Z.449345370-stepnem@smrk.net
---
mime-node.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mime-node.c b/mime-node.c
index 1c5d619b..6d9c15ac 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -374,6 +374,11 @@ _mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
/* Promote part to an envelope and open it */
GMimeMessagePart *message_part = GMIME_MESSAGE_PART (part);
GMimeMessage *message = g_mime_message_part_get_message (message_part);
+ if (! message) {
+ fprintf (stderr, "Warning: null message part, ignoring\n");
+ return false;
+ }
+
node->envelope_part = message_part;
node->part = GMIME_OBJECT (message);
node->nchildren = 1;
@@ -461,6 +466,8 @@ mime_node_child (mime_node_t *parent, int child)
g_type_name (G_OBJECT_TYPE (parent->part)));
}
node = _mime_node_create (parent, sub, child);
+ if (! node)
+ return NULL;
if (child == parent->next_child && parent->next_part_num != -1) {
/* We're traversing in depth-first order. Record the child's
--
2.53.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org