diff --git a/contrib/imhttp/imhttp.c b/contrib/imhttp/imhttp.c index f09260b586..95704af985 100644 --- a/contrib/imhttp/imhttp.c +++ b/contrib/imhttp/imhttp.c @@ -487,7 +487,9 @@ processOctetMsgLen(const instanceConf_t *const inst, struct conn_wrkr_s *connWrk connWrkr->parseState.iOctetsRemain = connWrkr->parseState.iOctetsRemain * 10 + ch - '0'; } // temporarily save this character into the message buffer - connWrkr->pMsg[connWrkr->iMsg++] = ch; + if(connWrkr->iMsg + 1 < s_iMaxLine) { + connWrkr->pMsg[connWrkr->iMsg++] = ch; + } } else { const char *remoteAddr = ""; if (connWrkr->propRemoteAddr) { diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c index 2df46a236c..c32dec5851 100644 --- a/plugins/imptcp/imptcp.c +++ b/plugins/imptcp/imptcp.c @@ -1107,7 +1107,9 @@ processDataRcvd(ptcpsess_t *const __restrict__ pThis, if(pThis->iOctetsRemain <= 200000000) { pThis->iOctetsRemain = pThis->iOctetsRemain * 10 + c - '0'; } - *(pThis->pMsg + pThis->iMsg++) = c; + if(pThis->iMsg < iMaxLine) { + *(pThis->pMsg + pThis->iMsg++) = c; + } } else { /* done with the octet count, so this must be the SP terminator */ DBGPRINTF("TCP Message with octet-counter, size %d.\n", pThis->iOctetsRemain); prop.GetString(pThis->peerName, &propPeerName, &lenPeerName); diff --git a/runtime/tcps_sess.c b/runtime/tcps_sess.c index 0efa2c23c4..c5442f7638 100644 --- a/runtime/tcps_sess.c +++ b/runtime/tcps_sess.c @@ -390,7 +390,9 @@ processDataRcvd(tcps_sess_t *pThis, if(pThis->iOctetsRemain <= 200000000) { pThis->iOctetsRemain = pThis->iOctetsRemain * 10 + c - '0'; } - *(pThis->pMsg + pThis->iMsg++) = c; + if(pThis->iMsg < iMaxLine) { + *(pThis->pMsg + pThis->iMsg++) = c; + } } else { /* done with the octet count, so this must be the SP terminator */ DBGPRINTF("TCP Message with octet-counter, size %d.\n", pThis->iOctetsRemain); prop.GetString(pThis->fromHost, &propPeerName, &lenPeerName);