adjust handling of too long lines in m_getfld2
authorPhilipp Takacs <philipp@bureaucracy.de>
Sat, 23 Apr 2016 18:46:20 +0000 (20:46 +0200)
committerPhilipp Takacs <philipp@bureaucracy.de>
Sun, 24 Apr 2016 10:24:21 +0000 (12:24 +0200)
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

index 45172aa..488a445 100644 (file)
@@ -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;
                        }