未验证 提交 696435cd 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

Hotfix/sangshuduo/td 3801 taosdump coverity scan issue for develop (#6831)

* fix converity scan issue.

* fix converity issues

* fix converity scan issue.
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 bf5b5b35
...@@ -124,6 +124,9 @@ typedef struct { ...@@ -124,6 +124,9 @@ typedef struct {
extern char version[]; extern char version[];
#define DB_PRECISION_LEN 8
#define DB_STATUS_LEN 16
typedef struct { typedef struct {
char name[TSDB_DB_NAME_LEN]; char name[TSDB_DB_NAME_LEN];
char create_time[32]; char create_time[32];
...@@ -144,9 +147,9 @@ typedef struct { ...@@ -144,9 +147,9 @@ typedef struct {
int32_t fsync; int32_t fsync;
int8_t comp; int8_t comp;
int8_t cachelast; int8_t cachelast;
char precision[8]; // time resolution char precision[DB_PRECISION_LEN]; // time resolution
int8_t update; int8_t update;
char status[16]; char status[DB_STATUS_LEN];
} SDbInfo; } SDbInfo;
typedef struct { typedef struct {
...@@ -542,7 +545,8 @@ static void parse_precision_first( ...@@ -542,7 +545,8 @@ static void parse_precision_first(
free(tmp); free(tmp);
exit(-1); exit(-1);
} }
strncpy(g_args.precision, tmp, strlen(tmp)); strncpy(g_args.precision, tmp,
min(DB_PRECISION_LEN - 1, strlen(tmp)));
free(tmp); free(tmp);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册