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

Merge pull request #11978 from taosdata/fix/tsim

fix: invalid port described in TD-15165
...@@ -62,7 +62,7 @@ typedef struct { ...@@ -62,7 +62,7 @@ typedef struct {
bool is_check; bool is_check;
bool is_startup; bool is_startup;
bool is_help; bool is_help;
uint16_t port; int32_t port;
int32_t pktLen; int32_t pktLen;
int32_t pktNum; int32_t pktNum;
int32_t displayWidth; int32_t displayWidth;
......
...@@ -99,6 +99,7 @@ static int32_t shellParseSingleOpt(int32_t key, char *arg) { ...@@ -99,6 +99,7 @@ static int32_t shellParseSingleOpt(int32_t key, char *arg) {
break; break;
case 'P': case 'P':
pArgs->port = atoi(arg); pArgs->port = atoi(arg);
if (pArgs->port == 0) pArgs->port = -1;
break; break;
case 'u': case 'u':
pArgs->user = arg; pArgs->user = arg;
...@@ -304,6 +305,11 @@ static int32_t shellCheckArgs() { ...@@ -304,6 +305,11 @@ static int32_t shellCheckArgs() {
return -1; return -1;
} }
if (pArgs->port < 0 || pArgs->port > 65535) {
printf("Invalid port\n");
return -1;
}
if (pArgs->pktLen < SHELL_MIN_PKG_LEN || pArgs->pktLen > SHELL_MAX_PKG_LEN) { if (pArgs->pktLen < SHELL_MIN_PKG_LEN || pArgs->pktLen > SHELL_MAX_PKG_LEN) {
printf("Invalid pktLen:%d, range:[%d, %d]\n", pArgs->pktLen, SHELL_MIN_PKG_LEN, SHELL_MAX_PKG_LEN); printf("Invalid pktLen:%d, range:[%d, %d]\n", pArgs->pktLen, SHELL_MIN_PKG_LEN, SHELL_MAX_PKG_LEN);
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册