fix 2fb1dd2271e5be9d0b0c9cbd4e7d6d5d51aaecb9
authorPhilipp Takacs <philipp@bureaucracy.de>
Sun, 24 Apr 2016 12:19:05 +0000 (14:19 +0200)
committerPhilipp Takacs <philipp@bureaucracy.de>
Sun, 24 Apr 2016 12:19:05 +0000 (14:19 +0200)
Do a length check in the header, but not in the body.

sbr/m_getfld2.c

index 488a445..956a556 100644 (file)
@@ -103,6 +103,10 @@ m_getfld2(enum state s, struct field *f, FILE *msg)
                                return IOERR2;
                        }
 
+                       if (nchars >= NAMESZ) {
+                               ret = LENERR2;
+                       }
+
                        if (*(tmpline + nchars - 1) != '\n') {
                                ret = FMTERR2;
                        }
@@ -141,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;