0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.0189: cd() with NULL argument crashes

Problem:    cd() with NULL argument crashes.
Solution:   Check for NULL. (Ken Takata, closes #5558)
This commit is contained in:
Bram Moolenaar 2020-01-31 22:41:38 +01:00
parent 7f829cab35
commit 7cc96923c4
3 changed files with 5 additions and 1 deletions

View File

@ -6572,7 +6572,7 @@ changedir_func(
int dir_differs;
int retval = FALSE;
if (allbuf_locked())
if (new_dir == NULL || allbuf_locked())
return FALSE;
if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !forceit)

View File

@ -101,6 +101,8 @@ func Test_chdir_func()
call assert_fails("call chdir('dir-abcd')", 'E472:')
silent! let d = chdir("dir_abcd")
call assert_equal("", d)
" Should not crash
call chdir(d)
only | tabonly
call chdir(topdir)

View File

@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
189,
/**/
188,
/**/