# HG changeset patch # User Christian Brabandt # Date 1485550806 -3600 # Node ID 905ab712979c1948532f77c49cfdf12bee722a4f # Parent 91ff9465b1b1d1d19cc9c37391915833cba80560 patch 8.0.0248: vim_strcat() cannot handle overlapping arguments commit https://github.com/vim/vim/commit/45600ce8f2bead069882032f992623cd5a799ca0 Author: Bram Moolenaar 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) diff --git a/src/misc2.c b/src/misc2.c --- 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); } /* diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 248, +/**/ 247, /**/ 246,