Re: [PATCH] Let mailsplit and mailinfo handle mails with CRLF line-endings
- From
Sverre Rabbelier <srabbelier@gmail.com>
- Date
- Aug 4, 2009, 17:34 UTC
- Message-ID
- <fabb9a1e0908041034y1a43fdf6nae14ec106a82f00c@mail.gmail.com>
- In-Reply-To
- <20090804172638.GA15136@blimp.localdomain>
Heya,
On Tue, Aug 4, 2009 at 10:26, Alex Riesen<raa.lkml@gmail.com> wrote:
> } > + if (len > 1 && buf[len - 2] == '\r') > + buf[--len - 1] = '\n'; > buf[len] = '\0';
How about something like:
+ if (len > 1 && buf[len - 2] == '\r' && (buf[len - 1] == '\n' || buf[len - 1] == '\0')) + buf[--len - 1] = '\n';
To make sure that we're not erasing a \r somewhere in the middle of the content?
-- Cheers, Sverre Rabbelier