Skip to content

Commit 8038568

Browse files
committed
patch 7.4.1665
Problem: Crash when calling job_start() with a NULL string. (Dominique) Solution: Check for an invalid argument.
1 parent 89c64d5 commit 8038568

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/channel.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3812,6 +3812,11 @@ job_start(typval_T *argvars)
38123812
{
38133813
/* Command is a string. */
38143814
cmd = argvars[0].vval.v_string;
3815+
if (cmd == NULL || *cmd == NUL)
3816+
{
3817+
EMSG(_(e_invarg));
3818+
return job;
3819+
}
38153820
#ifdef USE_ARGV
38163821
if (mch_parse_cmd(cmd, FALSE, &argv, &argc) == FAIL)
38173822
return job;

src/testdir/test_channel.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,5 +1201,10 @@ func Test_close_callback()
12011201
call s:run_server('s:test_close_callback')
12021202
endfunc
12031203

1204+
func Test_job_start_invalid()
1205+
call assert_fails('call job_start($x)', 'E474:')
1206+
call assert_fails('call job_start("")', 'E474:')
1207+
endfunc
1208+
12041209
" Uncomment this to see what happens, output is in src/testdir/channellog.
12051210
" call ch_logfile('channellog', 'w')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1665,
751753
/**/
752754
1664,
753755
/**/

0 commit comments

Comments
 (0)