]> granicus.if.org Git - vim/commitdiff
patch 8.0.1230: CTRL-A in Visual mode uses character after selection v8.0.1230
authorBram Moolenaar <Bram@vim.org>
Sat, 28 Oct 2017 14:07:33 +0000 (16:07 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 28 Oct 2017 14:07:33 +0000 (16:07 +0200)
Problem:    CTRL-A in Visual mode uses character after selection. (Nikolai
            Pavlov)
Solution:   Check the length before using a character.

src/charset.c
src/version.c

index a8b704c6985fb46d3d94f087905eb964b2544f76..003949f0a7a565312e1bea61294107e72d3bdb7c 100644 (file)
@@ -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;
                }
            }
        }
index 1da082d1f643a093f41edc68f47a91124a1d16e6..221c7576a15fea31831ab694434c1b8e4de8d091 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1230,
 /**/
     1229,
 /**/