[TD-1407] <fix> fix an issue coverity reports getenv() return a string with unknown size.

This commit is contained in:
Shuduo Sang 2020-09-10 14:18:17 +08:00
parent 18c920863a
commit ae20e56239
2 changed files with 2 additions and 2 deletions

View File

@ -786,7 +786,7 @@ void read_history() {
} }
void write_history() { void write_history() {
char f_history[128]; char f_history[TSDB_FILENAME_LEN];
get_history_path(f_history); get_history_path(f_history);
FILE *f = fopen(f_history, "w"); FILE *f = fopen(f_history, "w");

View File

@ -409,7 +409,7 @@ void set_terminal_mode() {
} }
} }
void get_history_path(char *history) { sprintf(history, "%s/%s", getenv("HOME"), HISTORY_FILE); } void get_history_path(char *history) { snprintf(history, TSDB_FILENAME_LEN, "%s/%s", getenv("HOME"), HISTORY_FILE); }
void clearScreen(int ecmd_pos, int cursor_pos) { void clearScreen(int ecmd_pos, int cursor_pos) {
struct winsize w; struct winsize w;