From: Philipp Takacs Date: Sat, 23 Apr 2016 18:46:20 +0000 (+0200) Subject: adjust handling of too long lines in m_getfld2 X-Git-Tag: mmh-0.3~37 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=2fb1dd2271e5be9d0b0c9cbd4e7d6d5d51aaecb9;p=mmh adjust handling of too long lines in m_getfld2 Now a field is complete read, if a line is to long. Also no length check is done in the body, because the caller can check f.valuelength. --- diff --git a/sbr/m_getfld2.c b/sbr/m_getfld2.c index 45172aa..488a445 100644 --- a/sbr/m_getfld2.c +++ b/sbr/m_getfld2.c @@ -96,17 +96,13 @@ m_getfld2(enum state s, struct field *f, FILE *msg) f->valuelen = nchars; } - while (ret == FLD2 && (falted = is_falted(msg)) == B_TRUE) { + while ((ret == FLD2 || ret == LENERR2) && (falted = is_falted(msg)) == B_TRUE) { nchars = getline(&tmpline, &len, msg); if (nchars <= 0) { free(tmpline); return IOERR2; } - if (nchars >= NAMESZ) { - ret = LENERR2; - } - if (*(tmpline + nchars - 1) != '\n') { ret = FMTERR2; }