comparison src/option.c @ 16706:77bcb5055fec v8.1.1355

patch 8.1.1355: obvious mistakes are accepted as valid expressions commit https://github.com/vim/vim/commit/16e9b85113e0b354ece1cb4f5fcc7866850f3685 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 19 19:59:35 2019 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 May 2019 20:00:09 +0200
parents 7e733046db1d
children e55c26aaf484
comparison
equal deleted inserted replaced
16705:033ac0bfd3ba 16706:77bcb5055fec
4760 else if (*arg == '-' || VIM_ISDIGIT(*arg)) 4760 else if (*arg == '-' || VIM_ISDIGIT(*arg))
4761 { 4761 {
4762 /* Allow negative (for 'undolevels'), octal and 4762 /* Allow negative (for 'undolevels'), octal and
4763 * hex numbers. */ 4763 * hex numbers. */
4764 vim_str2nr(arg, NULL, &i, STR2NR_ALL, 4764 vim_str2nr(arg, NULL, &i, STR2NR_ALL,
4765 &value, NULL, 0); 4765 &value, NULL, 0, TRUE);
4766 if (arg[i] != NUL && !VIM_ISWHITE(arg[i])) 4766 if (i == 0 || (arg[i] != NUL && !VIM_ISWHITE(arg[i])))
4767 { 4767 {
4768 errmsg = e_invarg; 4768 errmsg = N_("E521: Number required after =");
4769 goto skip; 4769 goto skip;
4770 } 4770 }
4771 } 4771 }
4772 else 4772 else
4773 { 4773 {