diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-10-28 16:07:33 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-10-28 16:07:33 +0200 |
commit | ce1577502693940f1f9285cd803a075b738a2330 (patch) | |
tree | d4dae3d0bf8fe7d1a80edbc21a0a80a98ad0763e /src/charset.c | |
parent | 9a91c7a1f9134f799b8672a4e3844781263e8cf3 (diff) | |
download | vim-git-ce1577502693940f1f9285cd803a075b738a2330.tar.gz |
patch 8.0.1230: CTRL-A in Visual mode uses character after selectionv8.0.1230
Problem: CTRL-A in Visual mode uses character after selection. (Nikolai
Pavlov)
Solution: Check the length before using a character.
Diffstat (limited to 'src/charset.c')
-rw-r--r-- | src/charset.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/charset.c b/src/charset.c index a8b704c69..003949f0a 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1852,7 +1852,7 @@ vim_isblankline(char_u *lbuf) * If "what" contains STR2NR_OCT recognize octal numbers * If "what" contains STR2NR_HEX recognize hex numbers * If "what" contains STR2NR_FORCE always assume bin/oct/hex. - * If maxlen > 0, check at a maximum maxlen chars + * If maxlen > 0, check at a maximum maxlen chars. */ void vim_str2nr( @@ -1900,7 +1900,7 @@ vim_str2nr( if (what & STR2NR_OCT) { /* Don't interpret "0", "08" or "0129" as octal. */ - for (n = 1; VIM_ISDIGIT(ptr[n]); ++n) + for (n = 1; n != maxlen && VIM_ISDIGIT(ptr[n]); ++n) { if (ptr[n] > '7') { @@ -1908,8 +1908,6 @@ vim_str2nr( break; } pre = '0'; /* assume octal */ - if (n == maxlen) - break; } } } |