diff 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
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -4612,7 +4612,7 @@ do_set(
 				    || (long *)varp == &p_wcm)
 				&& (*arg == '<'
 				    || *arg == '^'
-				    || ((!arg[1] || vim_iswhite(arg[1]))
+				    || (*arg != NUL && (!arg[1] || vim_iswhite(arg[1]))
 					&& !VIM_ISDIGIT(*arg))))
 			{
 			    value = string_to_key(arg);
@@ -5843,7 +5843,7 @@ set_string_option(
 							   opt_flags)) == NULL)
 	    did_set_option(opt_idx, opt_flags, TRUE);
 
-	/* call autocomamnd after handling side effects */
+	/* call autocommand after handling side effects */
 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
 	if (saved_oldval != NULL)
 	{