Commit 8b6cccc5 authored by Rocco Corsi's avatar Rocco Corsi
Browse files

TAB-TAB completion segfaulting with more than 2048 files fixed. (Rocco)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent ee289d7a
Showing with 8 additions and 3 deletions
+8 -3
...@@ -2,8 +2,13 @@ CVS code - ...@@ -2,8 +2,13 @@ CVS code -
- faq.html: - faq.html:
- Fix typos and small mistakes (Jordi). - Fix typos and small mistakes (Jordi).
- files.c: - files.c:
username_tab_completion()
- Added the (char *) sizeof when allocating memory for the filename
array (Rocco).
cwd_tab_completion() cwd_tab_completion()
- removed skipping . and .. when tabulating matches. - removed skipping . and .. when tabulating matches.
- Added the (char *) sizeof when allocating memory for the filename
array (Rocco).
- nano.c: - nano.c:
main() main()
- Reorder the getopt options to be more or less alphabetical - Reorder the getopt options to be more or less alphabetical
......
...@@ -688,8 +688,8 @@ char **username_tab_completion(char *buf, int *num_matches) ...@@ -688,8 +688,8 @@ char **username_tab_completion(char *buf, int *num_matches)
homedirs = (char **) NULL; homedirs = (char **) NULL;
*num_matches = 0; *num_matches = 0;
} }
matches = nmalloc(BUFSIZ); matches = nmalloc(BUFSIZ * sizeof(char *));
homedirs = nmalloc(BUFSIZ); homedirs = nmalloc(BUFSIZ * sizeof(char *));
strcat(buf, "*"); strcat(buf, "*");
do { do {
i = 0; i = 0;
...@@ -757,7 +757,7 @@ char **cwd_tab_completion(char *buf, int *num_matches) ...@@ -757,7 +757,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
DIR *dir; DIR *dir;
struct dirent *next; struct dirent *next;
matches = nmalloc(BUFSIZ); matches = nmalloc(BUFSIZ * sizeof(char *));
/* Stick a wildcard onto the buf, for later use */ /* Stick a wildcard onto the buf, for later use */
strcat(buf, "*"); strcat(buf, "*");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment