Add a patch to prevent a crash on empty messages

Resolves: rhbz#1224538
This commit is contained in:
Tomas Heinrich 2015-06-29 13:43:53 +02:00
parent 5f74814fc2
commit dfbc918c33
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,40 @@
From f1f77872ab6e962fcc7f53c0b51ef7b2d331c1bf Mon Sep 17 00:00:00 2001
From: Tomas Heinrich <theinric@redhat.com>
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

View File

@ -26,6 +26,8 @@ Patch0: rsyslog-8.8.0-sd-service.patch
# prevent modification of trusted properties (proposed upstream)
Patch1: rsyslog-8.8.0-immutable-json-props.patch
Patch2: rsyslog-8.8.0-missing-test-data.patch
# https://github.com/rsyslog/rsyslog/pull/412
Patch3: rsyslog-8.10.0-imjournal-empty-messages.patch
BuildRequires: bison
BuildRequires: dos2unix
@ -251,6 +253,7 @@ mv build doc
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%ifarch sparc64
@ -508,6 +511,8 @@ done
resolves: rhbz#1228192
- use systemctl for sending SIGHUP to the service
related: rhbz#1224972
- add a patch to prevent a crash on empty messages
resolves: rhbz#1224538
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild