]> diplodocus.org Git - nmh/commit
Fix a bug leading to message corruption with inc when incorporation more
authorKen Hornstein <kenh@pobox.com>
Mon, 21 Jan 2013 15:32:37 +0000 (10:32 -0500)
committerDavid Levine <levinedl@acm.org>
Thu, 24 Jan 2013 02:03:50 +0000 (20:03 -0600)
commit47bf6339eb158ba9884befc0c8dab46acb1c0100
treea1198ae5993ac277bdc0f8166341c25c4ed5c8c6
parent716f2cfbd1606cfbaa0970413fc48f40531451b2
Fix a bug leading to message corruption with inc when incorporation more
than one message at a time.

When I reworked the scan() code to remove the use of stdio internals,
two code paths were created.  The inc code path consumed another buffer
from the nxtbuf list for processing the message body.  At the end of
scan() there was code to push back all of the consumed buffers to the
nxtbuf list.  The extra buffer consumed in the inc code path wasn't
being pushed back, and as a result the nxtbuf list would end up with
duplicate pointers in it.  This would result in two components sharing
the same text buffer, which caused the message corruption.

When I looked at this closer, I realized that there was no reason to
push those buffers back to the list; nxtbuf gets reset to compbuffers
at the start of every call to scan(), and nxtbuf isn't used after the
buffers are pushed back.  Some researched revealed that this was the
same back in the original MH code.  I decided it was simplest to simply
delete the buffer recycling code.
(cherry picked from commit 22d2acba60374851c291260ff6aa716e9bf44a6d)
uip/scansbr.c