diff options
author | Kevin McCarthy <kevin@8t8.us> | 2023-01-03 09:57:57 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2023-01-03 09:57:57 -0800 |
commit | 0962ad1a71ceb22dc951d846572f05c57fab26f8 (patch) | |
tree | 01aab95969bd56209e65ec3b719d0299accd0d6b | |
parent | 51d47dfa99c34cbf84e0eb5db358e05b72534146 (diff) |
wip: enforce parsable from line after content-length delimited.
-rw-r--r-- | mbox.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -248,6 +248,7 @@ int mbox_parse_mailbox (CONTEXT *ctx) HEADER *curhdr; time_t t; int count = 0, lines = 0, has_mbox_sep = 0; + int expect_from_line = 1; LOFF_T loc; #ifdef NFS_ATTRIBUTE_HACK #ifdef HAVE_UTIMENSAT @@ -324,6 +325,7 @@ int mbox_parse_mailbox (CONTEXT *ctx) } count++; + expect_from_line = 0; if (!ctx->quiet) mutt_progress_update (&progress, count, @@ -403,6 +405,8 @@ int mbox_parse_mailbox (CONTEXT *ctx) /* return to the offset of the next *mbox* separator */ if (fseeko (ctx->fp, tmploc - 1, SEEK_SET) != 0) dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n")); + + expect_from_line = 1; } } @@ -421,6 +425,13 @@ int mbox_parse_mailbox (CONTEXT *ctx) { lines++; has_mbox_sep = !mutt_strcmp (MBOX_SEP, buf); + if (expect_from_line && !has_mbox_sep) + { + dprint (1, (debugfile, "mbox_parse_mailbox: missing From_ line at location: " + OFF_T_FMT "\n", loc)); + mutt_error _("Mailbox is corrupt!"); + return (-1); + } } loc = ftello (ctx->fp); |