diff --git a/ChangeLog b/ChangeLog index f5d94187d84ef43f2b78740431858eef05434fc6..af47f8f82eaed9e5da7a0ef1fa37fd0a4305d2fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ CVS code - Translation updates (see po/ChangeLog for details). - Fix globals and externs such that nano will compile with DISABLE_SPELLER (David Benbennick). +- files.c: + intput_tab() + - Fix assumption that matches is null terminated (David + Benbennick). - nano.c: main() - Fix nano not compiling with ENABLE_RCFILE and DISABLE_TABCOMP diff --git a/files.c b/files.c index 6580db66d2cf16ba7cb2acfcaacc49c87fcb26fe..2dfa1b60f45cc30db99f120ee653b6f53b3c9cf3 100644 --- a/files.c +++ b/files.c @@ -2116,6 +2116,8 @@ char **cwd_tab_completion(char *buf, int *num_matches) break; } } + closedir(dir); + free(dirname); return matches; } @@ -2312,7 +2314,7 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list) /* And if the next match isn't going to fit on the line, move to the next one */ - if (col > (COLS - longestname) && matches[i + 1] != NULL) { + if (col > COLS - longestname && i + 1 < num_matches) { editline++; wmove(edit, editline, 0); if (editline == editwinrows - 1) {