From 8979046d6a7ca405a8189db5ee5ef47bb7fdac5c Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 20 Aug 2016 21:53:55 +1000 Subject: [PATCH] Misc Fixes --- www_email.c | 6 +++--- www_msgs.c | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/www_email.c b/www_email.c index f7bdc3b..c363316 100644 --- a/www_email.c +++ b/www_email.c @@ -417,7 +417,7 @@ char *www_email_display(struct user_record *user, int email) { strcat(page, buffer); len += strlen(buffer); - sprintf(buffer, "> "); + sprintf(buffer, "> "); if (len + strlen(buffer) > max_len - 1) { max_len += 4096; page = (char *)realloc(page, max_len); @@ -429,10 +429,10 @@ char *www_email_display(struct user_record *user, int email) { for (i=0;i "); chars = 0; } else if (chars == 78) { - sprintf(buffer, "\n> %c", body[i]); + sprintf(buffer, "\n> %c", body[i]); chars = 1; } else { sprintf(buffer, "%c", body[i]); diff --git a/www_msgs.c b/www_msgs.c index 25bf0a7..b7fb5bd 100644 --- a/www_msgs.c +++ b/www_msgs.c @@ -299,7 +299,8 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i return NULL; } } - body = (char *)malloc(jmh.TxtLen); + body = (char *)malloc(jmh.TxtLen + 1); + memset(body, 0, jmh.TxtLen + 1); JAM_ReadMsgText(jb, jmh.TxtOffset,jmh.TxtLen, (char *)body); @@ -501,7 +502,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i strcat(page, buffer); len += strlen(buffer); - sprintf(buffer, "> "); + sprintf(buffer, "> "); if (len + strlen(buffer) > max_len - 1) { max_len += 4096; page = (char *)realloc(page, max_len); @@ -511,12 +512,12 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i chars = 0; - for (i=0;i "); chars = 0; } else if (chars == 78) { - sprintf(buffer, "\n> %c", body[i]); + sprintf(buffer, "\n> %c", body[i]); chars = 1; } else { sprintf(buffer, "%c", body[i]); @@ -745,6 +746,7 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference, for (z =0;z < strlen(body); z++) { if (body[z] != '\n') { body2[pos++] = body[z]; + body2[pos] = '\0'; } } strcat(body2, buffer);