From cafde3bef9afacafd2c151d848bb7cf61fc1b06e Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Mon, 17 Dec 2012 17:09:18 -0800 Subject: [PATCH] fix segfault in pop driver. when rereading the message header, the ENVELOPE* struct is freed, but ctx->subj_hash retains a pointer to env->real_subj, so the hash table entry must be deleted prior to calling mutt_free_envelope() http://pkgs.fedoraproject.org/cgit/mutt.git/tree/mutt-1.5.21-pophash.patch?h=f18 --- pop.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pop.c b/pop.c index 0c98942a8..9fa655432 100644 --- a/pop.c +++ b/pop.c @@ -618,8 +618,15 @@ int pop_fetch_message (MESSAGE* msg, CONTEXT* ctx, int msgno) } rewind (msg->fp); uidl = h->data; + + /* we replace envelop, key in subj_hash has to be updated as well */ + if (ctx->subj_hash && h->env->real_subj) + hash_delete (ctx->subj_hash, h->env->real_subj, h, NULL); mutt_free_envelope (&h->env); h->env = mutt_read_rfc822_header (msg->fp, h, 0, 0); + if (ctx->subj_hash && h->env->real_subj) + hash_insert (ctx->subj_hash, h->env->real_subj, h, 1); + h->data = uidl; h->lines = 0; fgets (buf, sizeof (buf), msg->fp); -- 2.50.1