Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit c833b1a2 authored by rswindell's avatar rswindell

Don't treat 0xE3 as a UTF-8 char unless the message buffer is valid UTF-8.

This should solve the problem of non-UTF-8 messages posted on non-up-to-date
systems (no UTF-8 support), yet the message has a "charset=utf-8" in a MIME
content-type header.
parent 08dad4e9
......@@ -37,6 +37,7 @@
#include "sbbs.h"
#include "qwk.h"
#include "utf8.h"
static void qwk_parse_header_list(ulong confnum, smbmsg_t* msg, str_list_t* headers, bool parse_sender_hfields, bool parse_recipient_hfields)
{
......@@ -279,7 +280,7 @@ bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks
/* Convert the QWK message text */
/********************************/
if((qwkbuf=(char *)malloc((blocks-1)*QWK_BLOCK_LEN))==NULL) {
if((qwkbuf=(char *)calloc(blocks, QWK_BLOCK_LEN))==NULL) { // over-allocate for NULL termination
errormsg(WHERE,ERR_ALLOC,"QWK msg buf",(blocks-1)*QWK_BLOCK_LEN);
return(false);
}
......@@ -308,7 +309,7 @@ bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks
kludges=strListInit();
char qwk_newline = QWK_NEWLINE;
if(smb_msg_is_utf8(msg))
if(smb_msg_is_utf8(msg) && utf8_str_is_valid(qwkbuf))
qwk_newline = '\n';
for(k=0;k<(blocks-1)*QWK_BLOCK_LEN;k++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment