File pmaixforwardedfrom-bugfix-potential-misadressing.patch of Package rsyslog.6132

Index: rsyslog-5.10.1/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c
===================================================================
--- rsyslog-5.10.1.orig/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c
+++ rsyslog-5.10.1/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c
@@ -103,6 +103,10 @@ dbgprintf("not a AIX message forwarded f
 	}
 	/* bump the message portion up by 23 characters to overwrite the "Message forwarded from " with the hostname */
 	lenMsg -=23;
+	if(lenMsg < 2) {
+		dbgprintf("not a AIX message forwarded from message has nothing after header\n");
+		ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE);
+	}
 	memmove(p2parse, p2parse + 23, lenMsg);
 	*(p2parse + lenMsg) = '\n';
 	*(p2parse + lenMsg + 1)  = '\0';
@@ -113,6 +117,11 @@ dbgprintf("not a AIX message forwarded f
 		--lenMsg;
 		++p2parse;
 	}
+	if (lenMsg < 1) {
+		dbgprintf("not a AIX message forwarded from message has nothing after colon "
+		"or no colon at all\n");
+		ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE);
+	}
 	if (lenMsg && *p2parse != ':') {
 dbgprintf("not a AIX message forwarded from mangled log but similar enough that the preamble has been removed\n");
 		ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE);
openSUSE Build Service is sponsored by