未验证 提交 f4fad0c0 编写于 作者: T tiantian001 提交者: GitHub

fix: change strcpy to tstrncpy

上级 dcd6f3e6
......@@ -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(reqMsg.pCont, "nettest", sizeof(reqMsg.pCont));
rpcSendRecv(pRpcConn, &epSet, &reqMsg, &rspMsg);
......@@ -600,7 +600,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);
......@@ -608,7 +608,7 @@ 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(reqMsg.pCont, "nettest speed", sizeof(reqMsg.pCont));
rpcSendRecv(pRpcConn, &epSet, &reqMsg, &rspMsg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册