From: Wilfried Goesgens Date: Fri, 15 Nov 2013 11:34:55 +0000 (+0100) Subject: MSG: safeguard: terminate the message buffer if we find an unclean message in the DB. X-Git-Tag: v9.01~192 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=b498f06a2b5242976387ca04ef9712e00f81dbb7 MSG: safeguard: terminate the message buffer if we find an unclean message in the DB. --- diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 776680b6d..1fff6dc47 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1129,6 +1129,13 @@ struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body) ret->cm_anon_type = *mptr++; /* Anon type byte */ ret->cm_format_type = *mptr++; /* Format type byte */ + + if (dmsgtext->ptr[dmsgtext->len - 1] != '\0') + { + MSG_syslog(LOG_ERR, "CtdlFetchMessage(%ld, %d) Forcefully terminating message!!\n", msgnum, with_body); + dmsgtext->ptr[dmsgtext->len - 1] = '\0'; + } + /* * The rest is zero or more arbitrary fields. Load them in. * We're done when we encounter either a zero-length field or