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