From: Honza Horak Date: Tue, 18 Dec 2012 01:09:18 +0000 (-0800) Subject: fix segfault in pop driver. when rereading the message header, the ENVELOPE* struct... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cafde3bef9afacafd2c151d848bb7cf61fc1b06e;p=neomutt 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 --- 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);