From b8664765e1c58e4443f86c57245d3d20dc31ce17 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 31 Mar 2020 21:34:49 +0300 Subject: mbox: fix a bug in expunge routine The bug will manifest itself by removal of the trailing newline in the last message in a block of unchanged messages when expunging the mailbox after removal of one or more messages before that block. Bug reported by Ken Olum. * libproto/mbox/mbox.c (mbox_expunge_unlocked): Fix an off-by-one error in computation of the file chunk size. --- libproto/mbox/mbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c index 52e48f8ce..768e464b3 100644 --- a/libproto/mbox/mbox.c +++ b/libproto/mbox/mbox.c @@ -1269,7 +1269,7 @@ mbox_expunge_unlocked (mu_mailbox_t mailbox, size_t dirty, int remove_deleted, return status; } status = mu_stream_copy (tempstr, mailbox->stream, - mum->body_end - mum->envel_from, NULL); + mum->body_end - mum->envel_from + 1, NULL); if (status) { mu_error (_("%s:%d: error copying: %s"), -- cgit v1.2.1