From 18e1267d96bf37a3737d38885304a2dc1365abde Mon Sep 17 00:00:00 2001 From: Milan Bartos Date: Tue, 31 Jul 2012 17:16:51 +0200 Subject: fix problem with cutting first 16 characters from message with bAnnotate on modified: plugins/imuxsock/imuxsock.c --- plugins/imuxsock/imuxsock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index 76474724..2d9d4b5d 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -768,7 +768,11 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim fixPID(bufParseTAG, &i, cred); MsgSetTAG(pMsg, bufParseTAG, i); - MsgSetMSGoffs(pMsg, pMsg->iLenRawMsg - lenMsg); + if (pLstn->bAnnotate) { + MsgSetMSGoffs(pMsg, pMsg->iLenRawMsg - lenMsg - 16); + } else { + MsgSetMSGoffs(pMsg, pMsg->iLenRawMsg - lenMsg); + } if(pLstn->bParseHost) { pMsg->msgFlags = pLstn->flags | PARSE_HOSTNAME; -- cgit From 6ed28016ca1a98f183f72d1d381a5027949ca965 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 16 Oct 2012 15:01:16 +0200 Subject: 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). --- plugins/imuxsock/imuxsock.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'plugins') 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; -- cgit