diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-02-09 01:58:54 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-02-09 01:58:54 -0500 |
commit | b9701c2a2b7b4633e894ad62955e0a0039dc0f95 (patch) | |
tree | 970a236df8b1ab30b5866487ff00f4e49c7c71bf /src/nvim/syntax.c | |
parent | 17ae27190d4589b2a35f44bc6c8b552f4bf06d4e (diff) | |
parent | 52692d3cd3e682a4116d3cec1fcf05880f0c77a1 (diff) | |
download | rneovim-b9701c2a2b7b4633e894ad62955e0a0039dc0f95.tar.gz rneovim-b9701c2a2b7b4633e894ad62955e0a0039dc0f95.tar.bz2 rneovim-b9701c2a2b7b4633e894ad62955e0a0039dc0f95.zip |
Merge #4152 'vim-patch:7.4.{798,800,805,810,811,814,815,816,817,820,825}'.
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index b46131b972..494683d254 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -4188,12 +4188,14 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing) break; if (p[1] == NUL) { EMSG2(_("E789: Missing ']': %s"), kw); - kw = p + 2; /* skip over the NUL */ - break; + goto error; } if (p[1] == ']') { - kw = p + 1; /* skip over the "]" */ - break; + if (p[2] != NUL) { + EMSG3(_("E890: trailing char after ']': %s]%s"), + kw, &p[2]); + goto error; + } } if (has_mbyte) { int l = (*mb_ptr2len)(p + 1); @@ -4208,6 +4210,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing) } } +error: xfree(keyword_copy); xfree(syn_opt_arg.cont_in_list); xfree(syn_opt_arg.next_list); @@ -4848,9 +4851,10 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci) int idx; char_u *cpo_save; - /* need at least three chars */ - if (arg == NULL || arg[1] == NUL || arg[2] == NUL) + // need at least three chars + if (arg == NULL || arg[0] == NUL || arg[1] == NUL || arg[2] == NUL) { return NULL; + } end = skip_regexp(arg + 1, *arg, TRUE, NULL); if (*end != *arg) { /* end delimiter not found */ |