From: Philipp Takacs Date: Sat, 14 Jul 2018 09:24:36 +0000 (+0200) Subject: check for crlf in m_getfld2 X-Git-Tag: mmh-0.4~28 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=1fadbab6f4c38dbd151898ecc158b3dc28e87f16;p=mmh check for crlf in m_getfld2 now header fields witch lines 998 chars and crlf are accepted. --- diff --git a/h/mh.h b/h/mh.h index 53b301e..20346b6 100644 --- a/h/mh.h +++ b/h/mh.h @@ -210,6 +210,7 @@ struct field { char *value; size_t valuelen; size_t alloclen; + boolean crlf; }; /* m_getfld2() states */ diff --git a/sbr/m_getfld2.c b/sbr/m_getfld2.c index 954ed33..b9a618d 100644 --- a/sbr/m_getfld2.c +++ b/sbr/m_getfld2.c @@ -62,7 +62,8 @@ m_getfld2(enum state s, struct field *f, FILE *msg) } } - if (nchars > NAMESZ) { + f->crlf = (nchars > 2 && tmpline[nchars-2] == '\r'); + if (nchars > NAMESZ+1 || (!f->crlf && nchars > NAMESZ)) { ret = LENERR2; } @@ -103,7 +104,7 @@ m_getfld2(enum state s, struct field *f, FILE *msg) return IOERR2; } - if (nchars > NAMESZ) { + if (nchars > NAMESZ+1 || (!f->crlf && nchars > NAMESZ)) { ret = LENERR2; } @@ -145,6 +146,7 @@ m_getfld2(enum state s, struct field *f, FILE *msg) } } + f->crlf = (nchars > 2 && tmpline[nchars-2] == '\r'); free(f->value); f->value = tmpline; f->valuelen = nchars;