nmh-workers
[Top] [All Lists]

Fix for large mailbox coredump

1998-02-24 11:08:13
I've just downloaded and installed nmh-0.23, which I believe is the latest.
My current inbox has 10378 messages, with 22202 as the most recent message id.
(You might have guessed that this represents some years of solid mh use.)
A sequence containing all messages is over 20Kb.  This tickles a memory
allocation bug in nmh.  The fix is appended below.

Large sequence handling was one of only two changes to MH that I needed
over the years.  The other change was to the message number selected
when adding a new message.  It is easy (with rmm) to get into a situation
where the current message is greater than the highest message number.  In
those situations, I want any new message(s) allocated higher than the current
message.  This means that cur never has to go backwards, and you don't get
new messages appearing to be the current message, or even appearing to be
recently read messages.  If you are interested in this change, I could
lend a hand.

Cheers,

Stephen.


*** seq_list.c.dist     Sat Jan  3 07:49:09 1998
--- seq_list.c  Tue Feb 24 20:43:57 1998
***************
*** 65,73 ****
         * 50 characters of the end.
         */
        if (bp - buffer > len - 50) {
            len += MAXBUFFER;
!           if (!(buffer = realloc (buffer, (size_t) len)))
                adios (NULL, "unable to realloc storage in seq_list");
        }
  
        /*
--- 65,77 ----
         * 50 characters of the end.
         */
        if (bp - buffer > len - 50) {
+           char *newbuf;
+ 
            len += MAXBUFFER;
!           if ((newbuf = realloc (buffer, (size_t) len)) == NULL)
                adios (NULL, "unable to realloc storage in seq_list");
+           bp = newbuf + (bp - buffer);
+           buffer = newbuf;
        }
  
        /*

The End.


<Prev in Thread] Current Thread [Next in Thread>
  • Fix for large mailbox coredump, Stephen McKay <=