]> git.marmaro.de Git - mmh/blobdiff - sbr/m_getfld2.c
Accept header lines of exactly 998 characters
[mmh] / sbr / m_getfld2.c
index 45172aa21f9040cbac6800c26ca52b325a9ba8e4..954ed331cef3e8c4811e8874051ea4bfde3b7d0e 100644 (file)
@@ -62,7 +62,7 @@ m_getfld2(enum state s, struct field *f, FILE *msg)
                        }
                }
 
                        }
                }
 
-               if (nchars >= NAMESZ) {
+               if (nchars > NAMESZ) {
                        ret = LENERR2;
                }
 
                        ret = LENERR2;
                }
 
@@ -96,14 +96,14 @@ m_getfld2(enum state s, struct field *f, FILE *msg)
                        f->valuelen = nchars;
                }
 
                        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;
                        }
 
                        nchars = getline(&tmpline, &len, msg);
                        if (nchars <= 0) {
                                free(tmpline);
                                return IOERR2;
                        }
 
-                       if (nchars >= NAMESZ) {
+                       if (nchars > NAMESZ) {
                                ret = LENERR2;
                        }
 
                                ret = LENERR2;
                        }
 
@@ -145,10 +145,6 @@ m_getfld2(enum state s, struct field *f, FILE *msg)
                        }
                }
 
                        }
                }
 
-               if (nchars >= NAMESZ) {
-                       ret = LENERR2;
-               }
-
                free(f->value);
                f->value = tmpline;
                f->valuelen = nchars;
                free(f->value);
                f->value = tmpline;
                f->valuelen = nchars;