mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
cli/crypto: fix segfault on failed gmime2 crypto context creation
Commit1fdc08d0ff
("cli/crypto: treat failure to create a crypto context as fatal.") started treating crypto context creation failures "as fatal", returning NULL from _mime_node_create(). Unfortunately, we do not have NULL checks for _mime_node_create() failures. The only caller, mime_node_child(), could check and return NULL (as it's documented to do on errors) but none of the several call sites have NULL checks either. And none of them really have a trivial but feasible and graceful way of recovery. So while the right thing to do would be to handle NULL returns properly all over the place, and we have other scenarios that do return NULL from above mentioned functions, the crypto context creation failure is something that does seem to show up regularly in some scenarios, revert back to the functionality before commit1fdc08d0ff
as an interim fix.
This commit is contained in:
parent
949c27144e
commit
cd3f5e1a93
1 changed files with 1 additions and 1 deletions
|
@ -247,7 +247,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
|
||||||
const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");
|
const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");
|
||||||
cryptoctx = notmuch_crypto_get_context (node->ctx->crypto, protocol);
|
cryptoctx = notmuch_crypto_get_context (node->ctx->crypto, protocol);
|
||||||
if (!cryptoctx)
|
if (!cryptoctx)
|
||||||
return NULL;
|
return node;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue