summaryrefslogtreecommitdiffstats
path: root/plugins/imuxsock
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-10-16 15:01:16 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-10-16 15:01:16 +0200
commit6ed28016ca1a98f183f72d1d381a5027949ca965 (patch)
treec50759ba20535b94ae8cb046d9fbc85c1d3d5888 /plugins/imuxsock
parent18e1267d96bf37a3737d38885304a2dc1365abde (diff)
downloadrsyslog-6ed28016ca1a98f183f72d1d381a5027949ca965.tar.gz
rsyslog-6ed28016ca1a98f183f72d1d381a5027949ca965.tar.xz
rsyslog-6ed28016ca1a98f183f72d1d381a5027949ca965.zip
bugfix: imuxsock truncated head of received message
This happened only under some circumstances. Thanks to Marius Tomaschwesky, Florian Piekert and Milan Bartos for their help in solving this issue. Note that Milan sent a patch, which solved the problem under some conditions (can be found somewhat earlier in git history). However, it did not handle the original root cause, and so did not fix the problem always. The main reason was that the date parser modifies the provided lenghts. That part of the API was not properly used by the caller (who decremented the length once more).
Diffstat (limited to 'plugins/imuxsock')
-rw-r--r--plugins/imuxsock/imuxsock.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 2d9d4b5d..cbb09b62 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -722,7 +722,7 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim
CHKiRet(msgConstructWithTime(&pMsg, &st, tt));
MsgSetRawMsg(pMsg, (char*)pRcv, lenRcv);
parser.SanitizeMsg(pMsg);
- lenMsg = pMsg->iLenRawMsg - offs;
+ lenMsg = pMsg->iLenRawMsg - offs; /* SanitizeMsg() may have changed the size */
MsgSetInputName(pMsg, pInputName);
MsgSetFlowControlType(pMsg, pLstn->flowCtl);
@@ -752,7 +752,6 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim
parse[15] = ' '; /* re-write \0 from fromatTimestamp3164 by SP */
/* update "counters" to reflect processed timestamp */
parse += 16;
- lenMsg -= 16;
}
}
@@ -767,12 +766,7 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim
if(pLstn->bWritePid)
fixPID(bufParseTAG, &i, cred);
MsgSetTAG(pMsg, bufParseTAG, i);
-
- if (pLstn->bAnnotate) {
- MsgSetMSGoffs(pMsg, pMsg->iLenRawMsg - lenMsg - 16);
- } else {
- MsgSetMSGoffs(pMsg, pMsg->iLenRawMsg - lenMsg);
- }
+ MsgSetMSGoffs(pMsg, pMsg->iLenRawMsg - lenMsg);
if(pLstn->bParseHost) {
pMsg->msgFlags = pLstn->flags | PARSE_HOSTNAME;