Package: mairix
Version: 0.20-1
Severity: normal
Tags: patch

Hello,

When a large mbox contains a message with a broken attachment such as a
missing end boundary, mairix keeps looking through the rest of the mbox
in hope of finding the end boundary.  This often futile activity takes
a long time if the mbox is large.  The following patch restricts the
search to the next 100 messages in the mbox.

--- mairix-0.20.orig/mbox.c
+++ mairix-0.20/mbox.c
@@ -866,6 +866,7 @@
       va = NULL; /* lazy mmap */
       for (j=mb->n_old_msgs_valid, here=mb->new_msgs; here; j++, here=next) {
         int n;
+        int trials = 0;
         off_t start;
         size_t len;
         struct rfc822 *r8;
@@ -903,14 +904,15 @@
             if (r8) free_rfc822(r8);
             r8 = NULL;
             last = last->next; /* Try with another chunk on the end */
+            ++trials;
           } else {
             /* Treat as success */
             next = last->next;
             break;
           }
-        } while (last);
+        } while (last && trials < 100);
 
-        if (last) {
+        if (last && trials < 100) {
           start = mb->start[j] = here->start;
           mb->len[j] = len;
           compute_checksum((char *) va + here->start, len, &mb->check_all[j]);

Thanks,
        Ken

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18
Locale: LANG=zh_TW.UTF-8, LC_CTYPE=zh_TW.UTF-8 (charmap=UTF-8)

Versions of packages mairix depends on:
ii  libbz2-1.0                  1.0.3-6      high-quality block-sorting file co
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  zlib1g                      1:1.2.3-13   compression library - runtime

mairix recommends no packages.

-- no debconf information

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
As the choice is essentially cosmetic there will likely be no end to
the debate on what the correct decision should be.
http://successor-ml.org/index.php?title=Quoting/anti-quoting

Attachment: signature.asc
Description: Digital signature

Reply via email to