summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-08-13 22:53:29 +0200
committerBram Moolenaar <Bram@vim.org>2015-08-13 22:53:29 +0200
commit1560d07045d416d0abf9731c43c28925f61515b6 (patch)
tree41bfa68f9e79834aac1134f344360619d5c17ed4 /src/syntax.c
parent8e8b486727a473fa21dccde3ec4541f7ee70c2f4 (diff)
downloadvim-git-1560d07045d416d0abf9731c43c28925f61515b6.tar.gz
patch 7.4.825v7.4.825
Problem: Invalid memory access for ":syn keyword x a[". Solution: Do not skip over the NUL. (Dominique Pelle)
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/syntax.c b/src/syntax.c
index e4ae0b1ae..c28a24c5c 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -4873,11 +4873,16 @@ syn_cmd_keyword(eap, syncing)
if (p[1] == NUL)
{
EMSG2(_("E789: Missing ']': %s"), kw);
- kw = p + 2; /* skip over the NUL */
- break;
+ goto error;
}
if (p[1] == ']')
{
+ if (p[2] != NUL)
+ {
+ EMSG3(_("E890: trailing char after ']': %s]%s"),
+ kw, &p[2]);
+ goto error;
+ }
kw = p + 1; /* skip over the "]" */
break;
}
@@ -4898,7 +4903,7 @@ syn_cmd_keyword(eap, syncing)
}
}
}
-
+error:
vim_free(keyword_copy);
vim_free(syn_opt_arg.cont_in_list);
vim_free(syn_opt_arg.next_list);