From f1f77872ab6e962fcc7f53c0b51ef7b2d331c1bf Mon Sep 17 00:00:00 2001 From: Tomas Heinrich Date: Tue, 23 Jun 2015 18:09:52 +0200 Subject: [PATCH 1/4] imjournal: don't sanitize empty messages It is an error to pass an empty message to parser.SanitizeMsg() and doing so could crash the daemon. Besides, there's no point in doing so in the first place. --- plugins/imjournal/imjournal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c index b5866e8..6ad9fca 100644 --- a/plugins/imjournal/imjournal.c +++ b/plugins/imjournal/imjournal.c @@ -176,6 +176,7 @@ enqMsg(uchar *msg, uchar *pszTag, int iFacility, int iSeverity, struct timeval * { struct syslogTime st; msg_t *pMsg; + size_t len; DEFiRet; assert(msg != NULL); @@ -189,8 +190,10 @@ enqMsg(uchar *msg, uchar *pszTag, int iFacility, int iSeverity, struct timeval * } MsgSetFlowControlType(pMsg, eFLOWCTL_LIGHT_DELAY); MsgSetInputName(pMsg, pInputName); - MsgSetRawMsgWOSize(pMsg, (char*)msg); - parser.SanitizeMsg(pMsg); + len = strlen((char*)msg); + MsgSetRawMsg(pMsg, (char*)msg, len); + if(len > 0) + parser.SanitizeMsg(pMsg); MsgSetMSGoffs(pMsg, 0); /* we do not have a header... */ MsgSetRcvFrom(pMsg, glbl.GetLocalHostNameProp()); MsgSetRcvFromIP(pMsg, pLocalHostIP); -- 1.9.3