From 17408b52e57b14d89388a10a1feedae7c3fbcf6d Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sat, 26 Aug 2006 15:46:20 +0000 Subject: [PATCH] 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 --- ChangeLog | 2 ++ src/browser.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9a448acf..357275a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,6 +69,8 @@ CVS code - - After entering "..", select the directory we were in before instead of the first filename in the list, as Pico does. (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() - During the operating directory check, if path isn't NULL, don't bother freeing it before mallocstrcpy()ing operating_dir diff --git a/src/browser.c b/src/browser.c index 2ae949a3..df620434 100644 --- a/src/browser.c +++ b/src/browser.c @@ -254,7 +254,7 @@ char *do_browser(char *path, DIR *dir) new_path = real_dir_from_tilde(answer); if (new_path[0] != '/') { - new_path = charealloc(new_path, strlen(new_path) + + new_path = charealloc(new_path, strlen(path) + strlen(answer) + 1); sprintf(new_path, "%s%s", path, answer); } -- 2.39.5