From: Bram Moolenaar Date: Fri, 27 Jan 2017 20:54:07 +0000 (+0100) Subject: patch 8.0.0248: vim_strcat() cannot handle overlapping arguments X-Git-Tag: v8.0.0248 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45600ce8f2bead069882032f992623cd5a799ca0;p=vim 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 index 9c39d4039..71ca6d8f5 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1719,7 +1719,7 @@ vim_strncpy(char_u *to, char_u *from, size_t len) /* * 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, size_t tosize) 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 index 199c37d5b..11259921b 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 248, /**/ 247, /**/