Commit 17408b52 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in do_browser(), fix potential segfault when going to a directory that

doesn't begin with '/'


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3852 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 3 additions and 1 deletion
+3 -1
...@@ -69,6 +69,8 @@ CVS code - ...@@ -69,6 +69,8 @@ CVS code -
- After entering "..", select the directory we were in before - After entering "..", select the directory we were in before
instead of the first filename in the list, as Pico does. (DLR) instead of the first filename in the list, as Pico does. (DLR)
- Simplify screen update handling and exiting. (DLR) - Simplify screen update handling and exiting. (DLR)
- Fix potential segfault when going to a directory that doesn't
begin with '/'. (DLR)
do_browse_from() do_browse_from()
- During the operating directory check, if path isn't NULL, - During the operating directory check, if path isn't NULL,
don't bother freeing it before mallocstrcpy()ing operating_dir don't bother freeing it before mallocstrcpy()ing operating_dir
......
...@@ -254,7 +254,7 @@ char *do_browser(char *path, DIR *dir) ...@@ -254,7 +254,7 @@ char *do_browser(char *path, DIR *dir)
new_path = real_dir_from_tilde(answer); new_path = real_dir_from_tilde(answer);
if (new_path[0] != '/') { if (new_path[0] != '/') {
new_path = charealloc(new_path, strlen(new_path) + new_path = charealloc(new_path, strlen(path) +
strlen(answer) + 1); strlen(answer) + 1);
sprintf(new_path, "%s%s", path, answer); sprintf(new_path, "%s%s", path, answer);
} }
......
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