mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-25 02:44:53 +01:00
crypto: return NULL cryptoctx if protocol string is empty.
Badly formed messages that don't specify a protocol in signed/encrypted parts, end up with a protocol of NULL. strcasecmp in notmuch_crypto_get_context then segfaults when trying to check it against known protocols. If the protocol is NULL, just return an empty context immediately (with appropriate message.)
This commit is contained in:
parent
03e2def474
commit
348437243c
1 changed files with 5 additions and 0 deletions
5
crypto.c
5
crypto.c
|
@ -69,6 +69,11 @@ notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)
|
|||
{
|
||||
notmuch_crypto_context_t *cryptoctx = NULL;
|
||||
|
||||
if (! protocol) {
|
||||
fprintf (stderr, "Cryptographic protocol is empty.\n");
|
||||
return cryptoctx;
|
||||
}
|
||||
|
||||
/* As per RFC 1847 section 2.1: "the [protocol] value token is
|
||||
* comprised of the type and sub-type tokens of the Content-Type".
|
||||
* As per RFC 1521 section 2: "Content-Type values, subtypes, and
|
||||
|
|
Loading…
Reference in a new issue