summaryrefslogtreecommitdiffstats
path: root/mh.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2020-12-21 15:30:01 -0800
committerKevin McCarthy <kevin@8t8.us>2020-12-22 17:40:53 -0800
commit11b18027d3d710f30c78e1171ea8ee94f75f0ac1 (patch)
tree4b2c95420a029f2f01253855503d5c2e91497294 /mh.c
parenta7b839e59c32f20daf2bd3737d70c851f5c9bf7d (diff)
Fix offset to use LOFF_T in a couple places.
The BODY->hdr_offset was incorrectly of type long, which could result in corrupted >2gb mbox files in some circumstances. The uses in mh_rewrite_message() are not as serious, but they should still be of type LOFF_T. I found both of these fixes in a patch file, bug-676388-largefile.patch, in the openSUSE mutt src rpm. It looks like Harald Koenig was the original author of a larger patch in that openSUSE ticket, which was reduced over time as fixes were made to Mutt. Note that patch file also incorrectly adjusted old_hdr_lines in mh.c. I've removed that part, as HEADER->lines is type int. Unfortunately, the BODY->hdr_offset type change will result in a header cache change (i.e. invalidation). I'm not enthused about doing that during a stable release, but the change is important enough to merit it.
Diffstat (limited to 'mh.c')
-rw-r--r--mh.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mh.c b/mh.c
index cd7aa040..5d90b3c3 100644
--- a/mh.c
+++ b/mh.c
@@ -1811,8 +1811,8 @@ static int mh_rewrite_message (CONTEXT * ctx, int msgno)
BUFFER *newpath = NULL;
BUFFER *partpath = NULL;
- long old_body_offset = h->content->offset;
- long old_body_length = h->content->length;
+ LOFF_T old_body_offset = h->content->offset;
+ LOFF_T old_body_length = h->content->length;
long old_hdr_lines = h->lines;
if ((dest = mx_open_new_message (ctx, h, 0)) == NULL)