Fix segfault maybe?

This commit is contained in:
Andrew Pamment 2017-03-31 07:46:51 +10:00
parent 593042c06a
commit d1bdc8dca2
2 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,7 @@ JAMLIB = deps/jamlib/jamlib.a
ZMODEM = deps/Xmodem/libzmodem.a
LUA = deps/lua/liblua.a
B64 = deps/libb64-1.2/src/libb64.a
MICROHTTPD=-lmicrohttpd -liconv
MICROHTTPD=-lmicrohttpd
ODOORS = deps/odoors/libs-`uname -s`/libODoors.a
JSMN = deps/jsmn/libjsmn.a
CDK = deps/cdk-5-20161210/libcdk.a

View File

@ -477,6 +477,10 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
ic = iconv_open("UTF-8//TRANSLIT", "CP437");
iconv(ic, &aha_cp437, jmh.TxtLen, &aha_text, jmh.TxtLen);
iconv_close(ic);
free(aha_cp437);
aha_text[jmh.TxtLen] = '\0';
aha_out = aha(aha_text);
while (len + strlen(aha_out) > max_len - 1) {
max_len += 4096;
@ -487,7 +491,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
free(aha_out);
free(aha_text);
sprintf(buffer, "</div>\n");
if (len + strlen(buffer) > max_len - 1) {
max_len += 4096;