From c0e29010f68a0ebe439f9bd78493799c60b7bfd3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 27 Sep 2020 14:22:48 +0200 Subject: patch 8.2.1755: Vim9: crash when using invalid heredoc marker Problem: Vim9: crash when using invalid heredoc marker. (Dhiraj Mishra) Solution: Check for NULL list. (closes #7027) Fix comment character. --- src/evalvars.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/evalvars.c') diff --git a/src/evalvars.c b/src/evalvars.c index 357116937..9aa6d6554 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -558,6 +558,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get) int text_indent_len = 0; char_u *text_indent = NULL; char_u dot[] = "."; + int comment_char = in_vim9script() ? '#' : '"'; if (eap->getline == NULL) { @@ -585,11 +586,11 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get) } // The marker is the next word. - if (*cmd != NUL && *cmd != '"') + if (*cmd != NUL && *cmd != comment_char) { marker = skipwhite(cmd); p = skiptowhite(marker); - if (*skipwhite(p) != NUL && *skipwhite(p) != '"') + if (*skipwhite(p) != NUL && *skipwhite(p) != comment_char) { semsg(_(e_trailing_arg), p); return NULL; -- cgit v1.2.1