diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-17 21:32:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-17 21:32:09 +0200 |
commit | d3c907b5d2b352482b580a0cf687cbbea4c19ea1 (patch) | |
tree | 4ef356217c0b95e6f6ee5b5d3bb756c103ef8b82 /src/macros.h | |
parent | 6bff02eb530aa29aafa2cb5627399837be7a5dd5 (diff) | |
download | vim-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/macros.h')
-rw-r--r-- | src/macros.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/macros.h b/src/macros.h index ae784d6cc..28f43a362 100644 --- a/src/macros.h +++ b/src/macros.h @@ -274,7 +274,7 @@ /* Backup multi-byte pointer. Only use with "p" > "s" ! */ # define mb_ptr_back(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1 /* get length of multi-byte char, not including composing chars */ -# define mb_cptr2len(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)) +# define MB_CPTR2LEN(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)) # define MB_COPY_CHAR(f, t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++ # define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p)) @@ -282,6 +282,7 @@ # define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p)) #else # define MB_PTR2LEN(p) 1 +# define MB_CPTR2LEN(p) 1 # define mb_ptr_adv(p) ++p # define mb_cptr_adv(p) ++p # define mb_ptr_back(s, p) --p |