patch 8.1.1355: obvious mistakes are accepted as valid expressions
Problem: Obvious mistakes are accepted as valid expressions.
Solution: Be more strict about parsing numbers. (Yasuhiro Matsumoto,
closes #3981)
diff --git a/src/option.c b/src/option.c
index a9b9780..bfdf717 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4762,10 +4762,10 @@
/* Allow negative (for 'undolevels'), octal and
* hex numbers. */
vim_str2nr(arg, NULL, &i, STR2NR_ALL,
- &value, NULL, 0);
- if (arg[i] != NUL && !VIM_ISWHITE(arg[i]))
+ &value, NULL, 0, TRUE);
+ if (i == 0 || (arg[i] != NUL && !VIM_ISWHITE(arg[i])))
{
- errmsg = e_invarg;
+ errmsg = N_("E521: Number required after =");
goto skip;
}
}