- files.c:do_browser() - Fix incorrect path check for check_operating_dir() (David Benbennick)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1401 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2003-01-26 22:05:07 +00:00
parent a340766790
commit b698c35f4b
2 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,9 @@ CVS Code -
- Fix incorrect cursor location when cutting long lines - Fix incorrect cursor location when cutting long lines
(David Benbennick). (David Benbennick).
- files.c: - files.c:
do_browser()
- Fix incorrect path check for check_operating_dir()
(David Benbennick).
open_file() open_file()
- Fix FD leak with file load error (David Benbennick). - Fix FD leak with file load error (David Benbennick).
save_history() save_history()

View File

@ -2613,14 +2613,12 @@ char *do_browser(const char *inpath)
break; break;
} }
path = mallocstrcpy(path, filelist[selected]);
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
/* Note: The case of the user's being completely outside the /* Note: The case of the user's being completely outside the
operating directory is handled elsewhere, before this operating directory is handled elsewhere, before this
point */ point */
if (operating_dir != NULL) { if (operating_dir != NULL) {
if (check_operating_dir(path, 0)) { if (check_operating_dir(filelist[selected], 0)) {
statusbar(_("Can't visit parent in restricted mode")); statusbar(_("Can't visit parent in restricted mode"));
beep(); beep();
break; break;
@ -2628,6 +2626,8 @@ char *do_browser(const char *inpath)
} }
#endif #endif
path = mallocstrcpy(path, filelist[selected]);
/* SPK for '.' path, get the current path via getcwd */ /* SPK for '.' path, get the current path via getcwd */
if (!strcmp(path, "./..")) { if (!strcmp(path, "./..")) {
free(path); free(path);