From: Richard Russon Date: Mon, 29 Apr 2019 13:57:29 +0000 (+0100) Subject: libemail: fix envelope code for degenerate cases X-Git-Tag: 2019-10-25~233^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=874f7a4240b320ea84cfc9b734d5ce358e34773b;p=neomutt libemail: fix envelope code for degenerate cases --- diff --git a/email/envelope.c b/email/envelope.c index dd3b24b28..16c72cf43 100644 --- a/email/envelope.c +++ b/email/envelope.c @@ -98,6 +98,9 @@ void mutt_env_free(struct Envelope **p) */ void mutt_env_merge(struct Envelope *base, struct Envelope **extra) { + if (!base || !extra || !*extra) + return; + /* copies each existing element if necessary, and sets the element * to NULL in the source so that mutt_env_free doesn't leave us * with dangling pointers. */ @@ -202,6 +205,9 @@ bool mutt_env_cmp_strict(const struct Envelope *e1, const struct Envelope *e2) */ void mutt_env_to_local(struct Envelope *env) { + if (!env) + return; + mutt_addrlist_to_local(env->return_path); mutt_addrlist_to_local(env->from); mutt_addrlist_to_local(env->to); @@ -237,6 +243,9 @@ void mutt_env_to_local(struct Envelope *env) */ int mutt_env_to_intl(struct Envelope *env, const char **tag, char **err) { + if (!env) + return 1; + int e = 0; H_TO_INTL(return_path); H_TO_INTL(from);