From 874f7a4240b320ea84cfc9b734d5ce358e34773b Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 29 Apr 2019 14:57:29 +0100 Subject: [PATCH] libemail: fix envelope code for degenerate cases --- email/envelope.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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); -- 2.40.0