From fc8dcbab37199eb01f07949ad27c922c50fd1f48 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 25 Jan 2022 18:19:51 +0800 Subject: [PATCH] fix invalid write --- source/dnode/mnode/impl/src/mndSubscribe.c | 6 +++++- source/dnode/mnode/impl/src/mndTopic.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 2fc17ff13d..7fb8c19e3f 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -93,7 +93,11 @@ static int32_t mndProcessGetSubEpReq(SMnodeMsg *pMsg) { for (int32_t j = 0; j < assignedSz; j++) { SMqConsumerEp *pCEp = taosArrayGet(pSub->assigned, i); if (pCEp->consumerId == consumerId) { - taosArrayPush(pSub->assigned, pCEp); + SMqSubVgEp vgEp = { + .epSet = pCEp->epSet, + .vgId = pCEp->vgId + }; + taosArrayPush(topicEp.vgs, &vgEp); } } if (taosArrayGetSize(topicEp.vgs) != 0) { diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index b4e87fcf4c..6b4cb4ba59 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -237,7 +237,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SMnodeMsg *pMsg, SCMCreateTopicReq tstrncpy(topicObj.db, pDb->name, TSDB_DB_FNAME_LEN); topicObj.createTime = taosGetTimestampMs(); topicObj.updateTime = topicObj.createTime; - topicObj.uid = mndGenerateUid(pCreate->name, TSDB_TOPIC_FNAME_LEN); + topicObj.uid = mndGenerateUid(pCreate->name, strlen(pCreate->name)); topicObj.dbUid = pDb->uid; topicObj.version = 1; topicObj.sql = strdup(pCreate->sql); -- GitLab