From ea60cd2ae6ad05e1c75f63027afa61e8b3472a61 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Thu, 14 Sep 2017 23:00:40 +0200 Subject: [PATCH] Fix issue of write after allocated buffer. --- m-string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m-string.h b/m-string.h index c23c8c22..0657e6f9 100644 --- a/m-string.h +++ b/m-string.h @@ -676,10 +676,10 @@ string_fget_word (string_t v, const char separator[], FILE *f) if (strchr(separator, c) != NULL) return retcode; /* Next char is not a separator: continue parsing */ - v->ptr[v->size++] = c; - v->ptr[v->size] = 0; stringi_fit2size (v, v->alloc + v->alloc/2); assert (v->alloc > v->size + 1); + v->ptr[v->size++] = c; + v->ptr[v->size] = 0; } return retcode; }