components/mutt/patches/6982855-imap-segfault-fix.patch
changeset 384 cef5d5e02ade
equal deleted inserted replaced
383:e37246d1c149 384:cef5d5e02ade
       
     1 Index: imap/message.c
       
     2 ===================================================================
       
     3 --- mutt-1.5.21.orig/imap/message.c	(revision 6121:6572e8bcd723)
       
     4 +++ mutt-1.5.21/imap/message.c	(revision 6185:0e4f1782ea2e)
       
     5 @@ -66,5 +66,5 @@
       
     6    FILE *fp;
       
     7    char tempfile[_POSIX_PATH_MAX];
       
     8 -  int msgno, idx;
       
     9 +  int msgno, idx = msgbegin - 1;
       
    10    IMAP_HEADER h;
       
    11    IMAP_STATUS* status;
       
    12 @@ -186,5 +186,5 @@
       
    13          }
       
    14  
       
    15 -        idx = h.sid - 1;
       
    16 +        idx++;
       
    17          ctx->hdrs[idx] = imap_hcache_get (idata, h.data->uid);
       
    18          if (ctx->hdrs[idx])
       
    19 @@ -212,4 +212,5 @@
       
    20            imap_free_header_data((void**) (void*) &h.data);
       
    21            evalhc = 0;
       
    22 +          idx--;
       
    23          }
       
    24        }
       
    25 @@ -274,4 +275,5 @@
       
    26          dprint (2, (debugfile, "msg_fetch_header: ignoring fetch response with no body\n"));
       
    27          mfhrc = -1;
       
    28 +        msgend--;
       
    29          continue;
       
    30        }
       
    31 @@ -280,5 +282,5 @@
       
    32        fputs ("\n\n", fp);
       
    33  
       
    34 -      idx = h.sid - 1;
       
    35 +      idx++;
       
    36        if (idx > msgend)
       
    37        {
       
    38 @@ -286,4 +288,5 @@
       
    39                      "unknown message number %d\n", h.sid));
       
    40          mfhrc = -1;
       
    41 +        idx--;
       
    42          continue;
       
    43        }
       
    44 @@ -293,4 +296,5 @@
       
    45  	dprint (2, (debugfile, "imap_read_headers: message %d is not new\n",
       
    46  		    h.sid));
       
    47 +        idx--;
       
    48  	continue;
       
    49        }