Mercurial > vim
comparison src/syntax.c @ 7017:0dbbdcf13e03 v7.4.825
patch 7.4.825
Problem: Invalid memory access for ":syn keyword x a[".
Solution: Do not skip over the NUL. (Dominique Pelle)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 13 Aug 2015 22:53:29 +0200 |
parents | 286fd54c7ae3 |
children | 8d513ddfe3ec |
comparison
equal
deleted
inserted
replaced
7016:8e6a279b5954 | 7017:0dbbdcf13e03 |
---|---|
4871 if (p == NULL) | 4871 if (p == NULL) |
4872 break; | 4872 break; |
4873 if (p[1] == NUL) | 4873 if (p[1] == NUL) |
4874 { | 4874 { |
4875 EMSG2(_("E789: Missing ']': %s"), kw); | 4875 EMSG2(_("E789: Missing ']': %s"), kw); |
4876 kw = p + 2; /* skip over the NUL */ | 4876 goto error; |
4877 break; | |
4878 } | 4877 } |
4879 if (p[1] == ']') | 4878 if (p[1] == ']') |
4880 { | 4879 { |
4880 if (p[2] != NUL) | |
4881 { | |
4882 EMSG3(_("E890: trailing char after ']': %s]%s"), | |
4883 kw, &p[2]); | |
4884 goto error; | |
4885 } | |
4881 kw = p + 1; /* skip over the "]" */ | 4886 kw = p + 1; /* skip over the "]" */ |
4882 break; | 4887 break; |
4883 } | 4888 } |
4884 #ifdef FEAT_MBYTE | 4889 #ifdef FEAT_MBYTE |
4885 if (has_mbyte) | 4890 if (has_mbyte) |
4896 ++p; | 4901 ++p; |
4897 } | 4902 } |
4898 } | 4903 } |
4899 } | 4904 } |
4900 } | 4905 } |
4901 | 4906 error: |
4902 vim_free(keyword_copy); | 4907 vim_free(keyword_copy); |
4903 vim_free(syn_opt_arg.cont_in_list); | 4908 vim_free(syn_opt_arg.cont_in_list); |
4904 vim_free(syn_opt_arg.next_list); | 4909 vim_free(syn_opt_arg.next_list); |
4905 } | 4910 } |
4906 } | 4911 } |