From 78c24ae1356ecf5aa106489dda071940f877ff34 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 13 May 2021 12:24:45 +0800 Subject: [PATCH] Hotfix/sangshuduo/td 3914 taosdemo func param segfault for develop (#6110) * [TD-3914]: taosdemo check func param input more. for develop branch. * [TD-3914]: taosdemo check func param more. for develop branch. * [TD-3914]: taosdemo input argument validation. (#6097) Co-authored-by: Shuduo Sang Co-authored-by: Shuduo Sang --- src/kit/taosdemo/taosdemo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index f584448e63..f6b511e5fa 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -725,7 +725,6 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { exit(EXIT_FAILURE); } tstrncpy(configDir, argv[++i], TSDB_FILENAME_LEN); - } else if (strcmp(argv[i], "-h") == 0) { if (argc == i+1) { printHelp(); @@ -849,6 +848,11 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { } arguments->num_of_CPR = atoi(argv[++i]); } else if (strcmp(argv[i], "-b") == 0) { + if (argc == i+1) { + printHelp(); + errorPrint("%s", "\n\t-b need valid string following!\n"); + exit(EXIT_FAILURE); + } sptr = arguments->datatype; ++i; if (strstr(argv[i], ",") == NULL) { -- GitLab