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