fix: tstrncpy len must add 1

This commit is contained in:
Alex Duan 2024-10-28 16:21:15 +08:00
parent 036b7ebefa
commit 6b6c9c884e
1 changed files with 2 additions and 2 deletions

View File

@ -1333,8 +1333,8 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) {
// append end ';'
char* p = taosMemoryCalloc(strLen + 8, 1);
if (p) {
tstrncpy(p, str, strLen);
tstrncpy(p + strLen, ";", 1);
tstrncpy(p, str, strLen + 1);
tstrncpy(p + strLen, ";", 1 + 1);
shellInsertStr(cmd, (char*)p, strLen + 1);
taosMemoryFree(p);
} else {