From: Philipp Takacs Date: Sun, 24 Apr 2016 12:19:05 +0000 (+0200) Subject: fix 2fb1dd2271e5be9d0b0c9cbd4e7d6d5d51aaecb9 X-Git-Tag: mmh-0.3~32 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=18b08c1d08cc93b6d86c4e71013e5f8dd3ea103b;p=mmh fix 2fb1dd2271e5be9d0b0c9cbd4e7d6d5d51aaecb9 Do a length check in the header, but not in the body. --- diff --git a/sbr/m_getfld2.c b/sbr/m_getfld2.c index 488a445..956a556 100644 --- a/sbr/m_getfld2.c +++ b/sbr/m_getfld2.c @@ -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;