fix: shellReadHistory access invalid memory
This commit is contained in:
parent
09a04ed0a4
commit
2b5cf56556
|
@ -1019,7 +1019,7 @@ void shellReadHistory() {
|
|||
|
||||
char *line = taosMemoryMalloc(TSDB_MAX_ALLOWED_SQL_LEN + 1);
|
||||
int32_t read_size = 0;
|
||||
while ((read_size = taosGetsFile(pFile, TSDB_MAX_ALLOWED_SQL_LEN, line)) != -1) {
|
||||
while ((read_size = taosGetsFile(pFile, TSDB_MAX_ALLOWED_SQL_LEN, line)) > 0) {
|
||||
line[read_size - 1] = '\0';
|
||||
taosMemoryFree(pHistory->hist[pHistory->hend]);
|
||||
pHistory->hist[pHistory->hend] = taosStrdup(line);
|
||||
|
|
Loading…
Reference in New Issue