Package: mutt
Version: 1.5.13-1.1
Severity: normal
Tags: patch

When fetching a long series of emails from an IMAP server, if the server 
ends up skipping messages or truncating the list, mutt will crash when 
closing the mailbox.

Attached is a patch to fix this, from upstream[1]

Thanks!

-Kees

[1] 
http://news.gmane.org/find-root.php?message_id=%3c20070205215428.GA12395%40jabberwocky.com%3e

-- 
Kees Cook                                            @outflux.net
Index: mutt-1.5.13/imap/imap.c
===================================================================
--- mutt-1.5.13.orig/imap/imap.c	2007-02-11 10:07:01.000000000 -0800
+++ mutt-1.5.13/imap/imap.c	2007-02-11 10:12:38.000000000 -0800
@@ -1300,7 +1300,8 @@
 
   /* free IMAP part of headers */
   for (i = 0; i < ctx->msgcount; i++)
-    imap_free_header_data (&(ctx->hdrs[i]->data));
+    if (ctx->hdrs[i])
+      imap_free_header_data (&(ctx->hdrs[i]->data));
 
   for (i = 0; i < IMAP_CACHE_LEN; i++)
   {
Index: mutt-1.5.13/thread.c
===================================================================
--- mutt-1.5.13.orig/thread.c	2007-02-11 10:11:33.000000000 -0800
+++ mutt-1.5.13/thread.c	2007-02-11 10:12:01.000000000 -0800
@@ -555,8 +555,11 @@
 
   for (i = 0; i < ctx->msgcount; i++)
   {
-    ctx->hdrs[i]->thread = NULL;
-    ctx->hdrs[i]->threaded = 0;
+    if (ctx->hdrs[i])
+    {
+      ctx->hdrs[i]->thread = NULL;
+      ctx->hdrs[i]->threaded = 0;
+    }
   }
   ctx->tree = NULL;
 

Reply via email to