Mercurial > vim
changeset 10716:905ab712979c v8.0.0248
patch 8.0.0248: vim_strcat() cannot handle overlapping arguments
commit https://github.com/vim/vim/commit/45600ce8f2bead069882032f992623cd5a799ca0
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 27 21:54:07 2017 +0100
patch 8.0.0248: vim_strcat() cannot handle overlapping arguments
Problem: vim_strcat() cannot handle overlapping arguments.
Solution: Use mch_memmove() instead of strcpy(). (Justin M Keyes,
closes #1415)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 27 Jan 2017 22:00:06 +0100 |
parents | 91ff9465b1b1 |
children | ce294559a826 |
files | src/misc2.c src/version.c |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/misc2.c +++ b/src/misc2.c @@ -1719,7 +1719,7 @@ vim_strncpy(char_u *to, char_u *from, si /* * Like strcat(), but make sure the result fits in "tosize" bytes and is - * always NUL terminated. + * always NUL terminated. "from" and "to" may overlap. */ void vim_strcat(char_u *to, char_u *from, size_t tosize) @@ -1733,7 +1733,7 @@ vim_strcat(char_u *to, char_u *from, siz to[tosize - 1] = NUL; } else - STRCPY(to + tolen, from); + mch_memmove(to + tolen, from, fromlen + 1); } /*