]> granicus.if.org Git - neomutt/commitdiff
fix index allocation
authorRichard Russon <rich@flatcap.org>
Mon, 8 Oct 2018 12:11:08 +0000 (13:11 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 8 Oct 2018 12:18:08 +0000 (13:18 +0100)
The `vcount` wasn't being reset, so the index overflowed later.

maildir/mh.c

index e0515d133dc97ead8510126a956ee96c5de3157c..e1b0593c1f330b7107970be04e2107e3774cedc3 100644 (file)
@@ -817,10 +817,14 @@ static bool maildir_add_to_context(struct Context *ctx, struct Maildir *md)
 {
   int oldmsgcount = ctx->mailbox->msg_count;
 
-  /* Allocate some memory to get started */
-  ctx->mailbox->msg_count = 1;
-  mx_alloc_memory(ctx->mailbox);
-  ctx->mailbox->msg_count = 0;
+  if (!ctx->mailbox->hdrs)
+  {
+    /* Allocate some memory to get started */
+    ctx->mailbox->hdrmax = ctx->mailbox->msg_count;
+    ctx->mailbox->msg_count = 0;
+    ctx->mailbox->vcount = 0;
+    mx_alloc_memory(ctx->mailbox);
+  }
 
   while (md)
   {