X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmessages.c;h=8e7c1237f66107050948d1ad1a044d8facdb15ec;hb=f923045e1b4d66c66453b2f4f30ebd7f4ed6cef5;hp=1ffad7c36bdce300f1df5f0f3ad84b9420f7e06b;hpb=5937c6f4ddebd391ee5c7e85c6070784274c6f1d;p=citadel.git
diff --git a/webcit/messages.c b/webcit/messages.c
index 1ffad7c36..8e7c1237f 100644
--- a/webcit/messages.c
+++ b/webcit/messages.c
@@ -235,12 +235,17 @@ void output_chosen_part(long msgnum, char *multipart_chosen) {
strcpy(content_type, "text/plain");
}
- partbuf = malloc(total_length);
+ partbuf = malloc(total_length + 1);
if (partbuf == NULL) {
wprintf("Memory allocation error
");
return;
}
+ partbuf[total_length] = 0; /* Give it a nice null terminator */
+
+ /* FIXME ... add something to make this die if we
+ * lose the server connection.
+ */
while (downloaded_length < total_length) {
if ((total_length - downloaded_length) < 4096) {
block_length = total_length - downloaded_length;
@@ -263,6 +268,9 @@ void output_chosen_part(long msgnum, char *multipart_chosen) {
if (!strcasecmp(content_type, "text/plain")) {
output_text_plain(partbuf, total_length);
}
+ if (!strcasecmp(content_type, "text/html")) {
+ output_text_html(partbuf, total_length);
+ }
else {
wprintf("Unknown content type %s
\n",
content_type);