On Fri, Mar 11, 2016 at 03:04:55PM +0100, Vincent Lefevre wrote:
> I can see in mbox.c:
>
> if (i == 0)
> {
> ctx->size = ftello (ctx->fp); /* update the size of the mailbox */
> ftruncate (fileno (ctx->fp), ctx->size);
> }
>
> It is not checked whether ftruncate has failed. I suppose that
> this could cause data loss or data corruption.
>
> The attached patch, based on what is done for fseeko, should fix this.
>
> However, with this patch, if ftruncate fails, Mutt crashes.
> Actually, it seems that the error case i == -1 isn't handled
> correctly (same problem if fseeko fails).Looks like this is because the call to mx_fastclose_mailbox() was trying to free ctx->fp again. Changing the first close to use safe_fclose() fixes the problem. I'll just add that to your patch and push it. Thank you Vincent! -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA http://www.8t8.us/configs/gpg-key-transition-statement.txt
signature.asc
Description: PGP signature
