Attempt to fix cut off messages

This commit is contained in:
Andrew Pamment 2016-04-10 19:30:43 +10:00
parent b94dbb4fa1
commit 9e76b50b8e

View File

@ -339,6 +339,8 @@ char *external_editor(int socket, struct user_record *user, char *to, char *from
body = (char *)realloc(body, totlen + 1); body = (char *)realloc(body, totlen + 1);
} }
memcpy(&body[totlen - len], buffer, len); memcpy(&body[totlen - len], buffer, len);
body[totlen] = '\0'; body[totlen] = '\0';
@ -365,6 +367,8 @@ char *external_editor(int socket, struct user_record *user, char *to, char *from
for (i=0;i<totlen;i++) { for (i=0;i<totlen;i++) {
if (body[i] == '\n') { if (body[i] == '\n') {
continue; continue;
} else if (body[i] == '\0') {
continue;
} }
body2[j++] = body[i]; body2[j++] = body[i];
body2[j] = '\0'; body2[j] = '\0';