From: David Lawrence Ramsey Date: Fri, 30 Jun 2006 07:12:14 +0000 (+0000) Subject: fix breakage X-Git-Tag: v1.9.99pre1~161 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=780f1d3f782b3f8316b3896a8837ded68c960a0d;p=nano.git fix breakage git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3700 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/src/browser.c b/src/browser.c index 4de69a4e..00310e28 100644 --- a/src/browser.c +++ b/src/browser.c @@ -246,12 +246,13 @@ char *do_browser(char *path, DIR *dir) new_path_len = strlen(new_path) + 1; if (new_path[0] != '/') { - new_path = charealloc(new_path, strlen(path) + - strlen(answer) + 1); + new_path = charealloc(new_path, new_path_len + + strlen(answer)); sprintf(new_path, "%s%s", path, answer); } - if (new_path[new_path_len - 1] == '/') + if (new_path_len > 1 && + new_path[new_path_len - 1] == '/') null_at(&new_path, new_path_len - 1); /* We can't move up from "/". */