comparison src/option.c @ 10962:6da4287fd735 v8.0.0370

patch 8.0.0370: invalid memory access when setting wildchar empty commit https://github.com/vim/vim/commit/a12e40351d1357687e8b5dc3122fffef705bdc08 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 25 21:37:57 2017 +0100 patch 8.0.0370: invalid memory access when setting wildchar empty Problem: Invalid memory access when setting wildchar empty. Solution: Avoid going over the end of the option value. (Dominique Pelle, closes #1509) Make option test check all number options with empty value.
author Christian Brabandt <cb@256bit.org>
date Sat, 25 Feb 2017 21:45:04 +0100
parents d7b78cbf85e4
children 398ad090256d
comparison
equal deleted inserted replaced
10961:fb50279310e3 10962:6da4287fd735
4610 } 4610 }
4611 else if (((long *)varp == &p_wc 4611 else if (((long *)varp == &p_wc
4612 || (long *)varp == &p_wcm) 4612 || (long *)varp == &p_wcm)
4613 && (*arg == '<' 4613 && (*arg == '<'
4614 || *arg == '^' 4614 || *arg == '^'
4615 || ((!arg[1] || vim_iswhite(arg[1])) 4615 || (*arg != NUL && (!arg[1] || vim_iswhite(arg[1]))
4616 && !VIM_ISDIGIT(*arg)))) 4616 && !VIM_ISDIGIT(*arg))))
4617 { 4617 {
4618 value = string_to_key(arg); 4618 value = string_to_key(arg);
4619 if (value == 0 && (long *)varp != &p_wcm) 4619 if (value == 0 && (long *)varp != &p_wcm)
4620 { 4620 {
5841 #endif 5841 #endif
5842 if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL, 5842 if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
5843 opt_flags)) == NULL) 5843 opt_flags)) == NULL)
5844 did_set_option(opt_idx, opt_flags, TRUE); 5844 did_set_option(opt_idx, opt_flags, TRUE);
5845 5845
5846 /* call autocomamnd after handling side effects */ 5846 /* call autocommand after handling side effects */
5847 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) 5847 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
5848 if (saved_oldval != NULL) 5848 if (saved_oldval != NULL)
5849 { 5849 {
5850 char_u buf_type[7]; 5850 char_u buf_type[7];
5851 sprintf((char *)buf_type, "%s", 5851 sprintf((char *)buf_type, "%s",