1
0
forked from aniani/vim

patch 8.2.0571: double free when passing invalid argument to job_start()

Problem:    Double free when passing invalid argument to job_start().
Solution:   Clear the argument when freed. (Masato Nishihata, closes #5926)
This commit is contained in:
Bram Moolenaar
2020-04-13 17:44:47 +02:00
parent 6e949784be
commit 0015795baa
3 changed files with 6 additions and 0 deletions

View File

@@ -4356,7 +4356,10 @@ build_argv_from_list(list_T *l, char ***argv, int *argc)
int i; int i;
for (i = 0; i < *argc; ++i) for (i = 0; i < *argc; ++i)
{
vim_free((*argv)[i]); vim_free((*argv)[i]);
(*argv)[i] = NULL;
}
return FAIL; return FAIL;
} }
(*argv)[*argc] = (char *)vim_strsave(s); (*argv)[*argc] = (char *)vim_strsave(s);

View File

@@ -1681,6 +1681,7 @@ func Test_job_start_fails()
call assert_fails('let job = job_start([" "])', 'E474:') call assert_fails('let job = job_start([" "])', 'E474:')
call assert_fails('let job = job_start("")', 'E474:') call assert_fails('let job = job_start("")', 'E474:')
call assert_fails('let job = job_start(" ")', 'E474:') call assert_fails('let job = job_start(" ")', 'E474:')
call assert_fails('let job = job_start(["ls", []])', 'E730:')
%bw! %bw!
endfunc endfunc

View File

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