From 18b08c1d08cc93b6d86c4e71013e5f8dd3ea103b Mon Sep 17 00:00:00 2001 From: Philipp Takacs Date: Sun, 24 Apr 2016 14:19:05 +0200 Subject: [PATCH] fix 2fb1dd2271e5be9d0b0c9cbd4e7d6d5d51aaecb9 Do a length check in the header, but not in the body. --- sbr/m_getfld2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; -- 1.7.10.4