aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
authorJurica Bradaric <jbradaric@gmail.com>2016-02-02 20:30:30 +0100
committerJurica Bradaric <jbradaric@gmail.com>2016-02-02 20:33:43 +0100
commit52692d3cd3e682a4116d3cec1fcf05880f0c77a1 (patch)
tree01fef152e67a8bf9bf001fdd02f1602fdc622081 /src/nvim/syntax.c
parent8d5cfe4ffcb44a924ba370a10c98ba089f018e2e (diff)
downloadrneovim-52692d3cd3e682a4116d3cec1fcf05880f0c77a1.tar.gz
rneovim-52692d3cd3e682a4116d3cec1fcf05880f0c77a1.tar.bz2
rneovim-52692d3cd3e682a4116d3cec1fcf05880f0c77a1.zip
vim-patch:7.4.825
Problem: Invalid memory access for ":syn keyword x a[". Solution: Do not skip over the NUL. (Dominique Pelle) https://github.com/vim/vim/commit/1560d07045d416d0abf9731c43c28925f61515b6
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index e91ea68891..f47c5eadd3 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4183,12 +4183,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);
@@ -4203,6 +4205,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);