diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 8ad9e9072b..a3093237cb 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -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 {