From 086f6427cefa5349483cfd66170614fe2779af94 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Mon, 5 Feb 2018 16:23:33 +1000 Subject: [PATCH] possibly fix another bug --- src/www_msgs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/www_msgs.c b/src/www_msgs.c index b02f4e6..077e5a3 100644 --- a/src/www_msgs.c +++ b/src/www_msgs.c @@ -701,7 +701,7 @@ static char *www_wordwrap(char *content, int cutoff) { char *last_space = NULL; char *ret = (char *)malloc(len + 1); int at = 0; - + int extra = 0; if (ret == NULL) { return NULL; } @@ -732,7 +732,8 @@ static char *www_wordwrap(char *content, int cutoff) { line_count = strlen(&last_space[1]); last_space = NULL; } else { - ret = (char *)realloc(ret, strlen(content) + 2); + extra++; + ret = (char *)realloc(ret, strlen(content) + extra + 1); if (ret == NULL) { return NULL; }