From c95dae6cbfd30aabbe80aa5022cda975200b1014 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 3 Jan 2019 04:24:23 -0600 Subject: [PATCH] imap-2007e-overflow.patch --- src/c-client/rfc822.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/c-client/rfc822.c b/src/c-client/rfc822.c index 07a724a..9bcc30e 100644 --- a/src/c-client/rfc822.c +++ b/src/c-client/rfc822.c @@ -384,6 +384,9 @@ void rfc822_parse_content (BODY *body,STRING *bs,char *h,unsigned long depth, if (CHR (bs) == '\012'){/* following LF? */ c = SNX (bs); i--; /* yes, slurp it */ } + if (!i) /* Make sure we don't get an overflow for */ + break; /* messages ending on \015 (or the following */ + /* i-- will cause i to be MAXINT. Not good.) */ case '\012': /* at start of a line, start with -- ? */ if (!(i && i-- && ((c = SNX (bs)) == '-') && i-- && ((c = SNX (bs)) == '-'))) break;