summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lang <david@lang.hm>2011-02-11 07:44:09 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-02-11 07:44:09 +0100
commita9736c6215cf6446c326b034648f63a79c0426f9 (patch)
tree84512ba38480e5e24c8c49330bbdc09480b4a7e4
parent2c1021a01f75f5bb3e16b7b952a2d29494943bed (diff)
downloadrsyslog-a9736c6215cf6446c326b034648f63a79c0426f9.tar.gz
rsyslog-a9736c6215cf6446c326b034648f63a79c0426f9.tar.xz
rsyslog-a9736c6215cf6446c326b034648f63a79c0426f9.zip
bugfix in pmsnare
when removing text from the message, decrement the length when you increment the pointer through the message. there were a number of places where this was missed. Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
-rw-r--r--plugins/pmsnare/pmsnare.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/pmsnare/pmsnare.c b/plugins/pmsnare/pmsnare.c
index ce2138b2..4a9880d4 100644
--- a/plugins/pmsnare/pmsnare.c
+++ b/plugins/pmsnare/pmsnare.c
@@ -137,14 +137,17 @@ CODESTARTparse
*p2parse = ' ';
lenMsg -=(tablength-2);
p2parse++;
+ lenMsg--;
memmove(p2parse, p2parse + (tablength-2), lenMsg);
*(p2parse + lenMsg) = '\n';
*(p2parse + lenMsg + 1) = '\0';
pMsg->iLenRawMsg -=(tablength-2);
pMsg->iLenMSG -=(tablength-2);
p2parse += snaremessage;
+ lenMsg -= snaremessage;
*p2parse = ' ';
p2parse++;
+ lenMsg--;
lenMsg -=(tablength-2);
memmove(p2parse, p2parse + (tablength-2), lenMsg);
*(p2parse + lenMsg) = '\n';
@@ -178,8 +181,10 @@ CODESTARTparse
}
if(snaremessage) {
p2parse += snaremessage;
+ lenMsg -= snaremessage;
*p2parse = ' ';
p2parse++;
+ lenMsg--;
lenMsg -=(tablength-2);
memmove(p2parse, p2parse + (tablength-2), lenMsg);
*(p2parse + lenMsg) = '\n';
@@ -190,7 +195,7 @@ CODESTARTparse
}
}
- DBGPRINTF("pmsnare: new mesage: [%d]'%s'\n", lenMsg, pMsg->pszRawMsg + pMsg->offAfterPRI);
+ DBGPRINTF("pmsnare: new message: [%d]'%s'\n", lenMsg, pMsg->pszRawMsg + pMsg->offAfterPRI);
ABORT_FINALIZE(RS_RET_COULD_NOT_PARSE);
finalize_it: