From e3c055e0c4f7b1f56d949e8707a230d03a155904 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 27 Oct 2022 10:08:12 +0800 Subject: [PATCH] fix(sync): fix coverity issues --- source/libs/sync/src/syncMain.c | 2 +- source/libs/sync/src/syncMessage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 44c19f5431..bf0f652074 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -3424,7 +3424,7 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde // config change finish if (pEntry->originalRpcType == TDMT_SYNC_CONFIG_CHANGE_FINISH) { - if (rpcMsg.pCont != NULL) { + if (rpcMsg.pCont != NULL && rpcMsg.contLen > 0) { code = syncNodeConfigChangeFinish(ths, &rpcMsg, pEntry); ASSERT(code == 0); } diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index 4001a955fb..7a8ea0c4d7 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -3026,7 +3026,7 @@ void syncReconfigFinishFromRpcMsg(const SRpcMsg* pRpcMsg, SyncReconfigFinish* pM } SyncReconfigFinish* syncReconfigFinishFromRpcMsg2(const SRpcMsg* pRpcMsg) { - SyncReconfigFinish* pMsg = syncReconfigFinishDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + SyncReconfigFinish* pMsg = syncReconfigFinishDeserialize2(pRpcMsg->pCont, (uint32_t)(pRpcMsg->contLen)); ASSERT(pMsg != NULL); return pMsg; } -- GitLab