mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit f53e8dc6721d55704fd7d6bd4bd238e42551deff
parent b57c2d9b096321f3bd17e5a8fad7f919318dc2b1
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Sun, 30 Apr 2017 18:26:49 +0200

mmime: check: allow up to 998 chars in header lines

Diffstat:
mmime.c | 28++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/mmime.c b/mmime.c @@ -371,15 +371,33 @@ check() off_t bithigh = 0; off_t bitlow = 0; off_t linelen = 0; - off_t maxlinelen = 0; + off_t maxheadlinelen = 0; + off_t maxbodylinelen = 0; int c; int l = -1; while ((c = getchar()) != EOF) { if (c == '\n') { - if (maxlinelen < linelen) - maxlinelen = linelen; + if (maxheadlinelen < linelen) + maxheadlinelen = linelen; + linelen = 0; + if (l == '\n') + break; + } else { + linelen++; + } + if (c != '\t' && c != '\n' && c < 32) + bitlow++; + if (c > 127) + bithigh++; + l = c; + } + + while ((c = getchar()) != EOF) { + if (c == '\n') { + if (maxbodylinelen < linelen) + maxbodylinelen = linelen; linelen = 0; } else { linelen++; @@ -391,7 +409,9 @@ check() l = c; } - if (bitlow == 0 && bithigh == 0 && maxlinelen <= 78 && l == '\n') + if (bitlow == 0 && bithigh == 0 && + maxheadlinelen < 998 && maxbodylinelen <= 78 && + l == '\n') return 0; else return 1;