From 607959a0825c48d96072d3c8c95f6500ab8bf662 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Mon, 29 Jun 2020 15:32:35 +0000 Subject: [PATCH] check the application message length before passing it to server --- src/rpc/src/rpcMain.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index ad1e971453..a59024f8db 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1034,15 +1034,20 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) { rpcMsg.ahandle = pConn->ahandle; if ( rpcIsReq(pHead->msgType) ) { - rpcMsg.handle = pConn; - rpcAddRef(pRpc); // add the refCount for requests + if (rpcMsg.contLen > 0) { + rpcMsg.handle = pConn; + rpcAddRef(pRpc); // add the refCount for requests - // start the progress timer to monitor the response from server app - if (pConn->connType != RPC_CONN_TCPS) - pConn->pTimer = taosTmrStart(rpcProcessProgressTimer, tsProgressTimer, pConn, pRpc->tmrCtrl); + // start the progress timer to monitor the response from server app + if (pConn->connType != RPC_CONN_TCPS) + pConn->pTimer = taosTmrStart(rpcProcessProgressTimer, tsProgressTimer, pConn, pRpc->tmrCtrl); - // notify the server app - (*(pRpc->cfp))(&rpcMsg, NULL); + // notify the server app + (*(pRpc->cfp))(&rpcMsg, NULL); + } else { + tDebug("%s, message body is empty, ignore", pConn->info); + rpcFreeCont(rpcMsg.pCont); + } } else { // it's a response SRpcReqContext *pContext = pConn->pContext; -- GitLab