summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-19 21:44:37 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-19 21:44:37 +0100
commit42f652f733550a0d8bc9b030c9a5a62e7e2d8668 (patch)
tree3831ddc50f8806904a4bc601fbe2ee6daa029a35
parentf05fa378229004fb64493b411b864709ce7da453 (diff)
patch 8.0.1617: Win32: :shell command in the GUI crashesv8.0.1617
Problem: Win32: :shell command in the GUI crashes. Solution: Handle the situation that "cmd" is NULL. (Yasuhiro Matsumoto, closes #2721)
-rw-r--r--src/os_win32.c18
-rw-r--r--src/version.c2
2 files changed, 16 insertions, 4 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index c3f3f687e3..b70a0025d1 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -4800,15 +4800,25 @@ mch_call_shell_terminal(
aco_save_T aco;
oparg_T oa; /* operator arguments */
- cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10;
-
+ if (cmd == NULL)
+ cmdlen = STRLEN(p_sh) + 1;
+ else
+ cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10;
newcmd = lalloc(cmdlen, TRUE);
if (newcmd == NULL)
return 255;
- vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd);
+ if (cmd == NULL)
+ {
+ STRCPY(newcmd, p_sh);
+ ch_log(NULL, "starting terminal to run a shell");
+ }
+ else
+ {
+ vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd);
+ ch_log(NULL, "starting terminal for system command '%s'", cmd);
+ }
init_job_options(&opt);
- ch_log(NULL, "starting terminal for system command '%s'", cmd);
argvar[0].v_type = VAR_STRING;
argvar[0].vval.v_string = newcmd;
diff --git a/src/version.c b/src/version.c
index 58c4e89848..92ca63ad12 100644
--- a/src/version.c
+++ b/src/version.c
@@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1617,
+/**/
1616,
/**/
1615,