未验证 提交 c234fc02 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #9050 from tiantian001/patch-1

fix: change strcpy to tstrncpy
......@@ -356,7 +356,7 @@ static int32_t taosNetCheckRpc(const char* serverFqdn, uint16_t port, uint16_t p
epSet.inUse = 0;
epSet.numOfEps = 1;
epSet.port[0] = port;
strcpy(epSet.fqdn[0], serverFqdn);
tstrncpy(epSet.fqdn[0], serverFqdn, sizeof(epSet.fqdn[0]));
reqMsg.msgType = TSDB_MSG_TYPE_NETWORK_TEST;
reqMsg.pCont = rpcMallocCont(pktLen);
......@@ -364,7 +364,7 @@ static int32_t taosNetCheckRpc(const char* serverFqdn, uint16_t port, uint16_t p
reqMsg.code = 0;
reqMsg.handle = NULL; // rpc handle returned to app
reqMsg.ahandle = NULL; // app handle set by client
strcpy(reqMsg.pCont, "nettest");
tstrncpy((char*)reqMsg.pCont, "nettest", pktLen);
rpcSendRecv(pRpcConn, &epSet, &reqMsg, &rspMsg);
......@@ -606,7 +606,7 @@ static void taosNetCheckSpeed(char *host, int32_t port, int32_t pkgLen,
epSet.inUse = 0;
epSet.numOfEps = 1;
epSet.port[0] = port;
strcpy(epSet.fqdn[0], host);
tstrncpy(epSet.fqdn[0], host, sizeof(epSet.fqdn[0]));
reqMsg.msgType = TSDB_MSG_TYPE_NETWORK_TEST;
reqMsg.pCont = rpcMallocCont(pkgLen);
......@@ -614,8 +614,8 @@ static void taosNetCheckSpeed(char *host, int32_t port, int32_t pkgLen,
reqMsg.code = 0;
reqMsg.handle = NULL; // rpc handle returned to app
reqMsg.ahandle = NULL; // app handle set by client
strcpy(reqMsg.pCont, "nettest speed");
tstrncpy((char*)reqMsg.pCont, "nettest speed", pkgLen);
rpcSendRecv(pRpcConn, &epSet, &reqMsg, &rspMsg);
int code = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册