From 2fb1dd2271e5be9d0b0c9cbd4e7d6d5d51aaecb9 Mon Sep 17 00:00:00 2001 From: Philipp Takacs Date: Sat, 23 Apr 2016 20:46:20 +0200 Subject: [PATCH] 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. --- sbr/m_getfld2.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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; } -- 1.7.10.4