summaryrefslogtreecommitdiff
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-17 21:32:09 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-17 21:32:09 +0200
commitd3c907b5d2b352482b580a0cf687cbbea4c19ea1 (patch)
tree4ef356217c0b95e6f6ee5b5d3bb756c103ef8b82 /src/evalfunc.c
parent6bff02eb530aa29aafa2cb5627399837be7a5dd5 (diff)
downloadvim-git-d3c907b5d2b352482b580a0cf687cbbea4c19ea1.tar.gz
patch 7.4.2223v7.4.2223
Problem: Buffer overflow when using latin1 character with feedkeys(). Solution: Check for an illegal character. Add a test.
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index cc38d94c9..b427ecf7e 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -11166,7 +11166,7 @@ f_strgetchar(typval_T *argvars, typval_T *rettv)
break;
}
--charidx;
- byteidx += mb_cptr2len(str + byteidx);
+ byteidx += MB_CPTR2LEN(str + byteidx);
}
}
#else
@@ -11326,7 +11326,7 @@ f_strcharpart(typval_T *argvars, typval_T *rettv)
if (nchar > 0)
while (nchar > 0 && nbyte < slen)
{
- nbyte += mb_cptr2len(p + nbyte);
+ nbyte += MB_CPTR2LEN(p + nbyte);
--nchar;
}
else
@@ -11341,7 +11341,7 @@ f_strcharpart(typval_T *argvars, typval_T *rettv)
if (off < 0)
len += 1;
else
- len += mb_cptr2len(p + off);
+ len += MB_CPTR2LEN(p + off);
--charlen;
}
}