0
0
mirror of https://github.com/vim/vim.git synced 2025-10-06 05:44:14 -04:00

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)
This commit is contained in:
Bram Moolenaar
2017-01-27 21:54:07 +01:00
parent aed6d0b81a
commit 45600ce8f2
2 changed files with 4 additions and 2 deletions

View File

@@ -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);
}
/*