From c52c3c2a9b2194c3afa9fc927438260d1688ed5b Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Tue, 27 Feb 2018 21:50:22 +1000 Subject: [PATCH] try to fix bug --- src/www_msgs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/www_msgs.c b/src/www_msgs.c index 929b20e..22f0fc8 100644 --- a/src/www_msgs.c +++ b/src/www_msgs.c @@ -704,7 +704,7 @@ static char *www_wordwrap(char *content, int cutoff) { int i; int line_count = 0; char *last_space = NULL; - char *ret = (char *)malloc(len + 1); + char *ret; int at = 0; int extra = 0; if (ret == NULL) { @@ -727,6 +727,8 @@ static char *www_wordwrap(char *content, int cutoff) { content[at] = '\0'; at = 0; + len = strlen(content); + ret = (char *)malloc(len + 1); for (i=0;i