diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-19 19:59:35 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-19 19:59:35 +0200 |
commit | 16e9b85113e0b354ece1cb4f5fcc7866850f3685 (patch) | |
tree | 2abe4e3cffe8b0281f0690e5570a47eb2198a826 /src/misc2.c | |
parent | f5842c5a533346c4ff41ff666e465c85f1de35d5 (diff) | |
download | vim-git-16e9b85113e0b354ece1cb4f5fcc7866850f3685.tar.gz |
patch 8.1.1355: obvious mistakes are accepted as valid expressionsv8.1.1355
Problem: Obvious mistakes are accepted as valid expressions.
Solution: Be more strict about parsing numbers. (Yasuhiro Matsumoto,
closes #3981)
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/misc2.c b/src/misc2.c index f9f6bf58e..dac66ffb2 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2832,7 +2832,12 @@ find_special_key( bp += 3; /* skip t_xx, xx may be '-' or '>' */ else if (STRNICMP(bp, "char-", 5) == 0) { - vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0); + vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE); + if (l == 0) + { + emsg(_(e_invarg)); + return 0; + } bp += l + 5; break; } @@ -2864,7 +2869,12 @@ find_special_key( && VIM_ISDIGIT(last_dash[6])) { /* <Char-123> or <Char-033> or <Char-0x33> */ - vim_str2nr(last_dash + 6, NULL, NULL, STR2NR_ALL, NULL, &n, 0); + vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, TRUE); + if (l == 0) + { + emsg(_(e_invarg)); + return 0; + } key = (int)n; } else |