Blame SOURCES/rsyslog-8.24.0-rhbz1768320-pmaixfw-CVE.patch

ff08e8
From 10549ba915556c557b22b3dac7e4cb73ad22d3d8 Mon Sep 17 00:00:00 2001
ff08e8
From: Rainer Gerhards <rgerhards@adiscon.com>
ff08e8
Date: Fri, 27 Sep 2019 13:36:02 +0200
ff08e8
Subject: [PATCH] pmaixforwardedfrom bugfix: potential misadressing
ff08e8
ff08e8
---
ff08e8
 contrib/pmaixforwardedfrom/pmaixforwardedfrom.c | 9 +++++++++
ff08e8
 1 file changed, 9 insertions(+)
ff08e8
ff08e8
diff --git a/contrib/pmaixforwardedfrom/pmaixforwardedfrom.c b/contrib/pmaixforwardedfrom/pmaixforwardedfrom.c
ff08e8
index 37157c7d4a..ebf12ebbef 100644
ff08e8
--- a/contrib/pmaixforwardedfrom/pmaixforwardedfrom.c
ff08e8
+++ b/contrib/pmaixforwardedfrom/pmaixforwardedfrom.c
ff08e8
@@ -109,6 +109,10 @@ CODESTARTparse
ff08e8
 	}
ff08e8
 	/* bump the message portion up by skipLen(23 or 5) characters to overwrite the "Message forwarded from " or "From " with the hostname */
ff08e8
 	lenMsg -=skipLen;
ff08e8
+	if(lenMsg < 2) {
ff08e8
+		dbgprintf("not a AIX message forwarded from message has nothing after header\n");
ff08e8
+		ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE);
ff08e8
+	}
ff08e8
 	memmove(p2parse, p2parse + skipLen, lenMsg);
ff08e8
 	*(p2parse + lenMsg) = '\n';
ff08e8
 	*(p2parse + lenMsg + 1)  = '\0';
ff08e8
@@ -120,6 +124,11 @@ really an AIX log, but has a similar preamble */
ff08e8
 		--lenMsg;
ff08e8
 		++p2parse;
ff08e8
 	}
ff08e8
+	if (lenMsg < 1) {
ff08e8
+		dbgprintf("not a AIX message forwarded from message has nothing after colon "
ff08e8
+			"or no colon at all\n");
ff08e8
+		ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE);
ff08e8
+	}
ff08e8
 	if (lenMsg && *p2parse != ':') {
ff08e8
 	DBGPRINTF("not a AIX message forwarded from mangled log but similar enough that the preamble has been removed\n");
ff08e8
 		ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE);