diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-01-27 21:54:07 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-01-27 21:54:07 +0100 |
commit | 45600ce8f2bead069882032f992623cd5a799ca0 (patch) | |
tree | 06276b999ac5cc079f80b28f1a97506429807ee0 /src/misc2.c | |
parent | aed6d0b81a14a81433c0f3c2c65cef935100db33 (diff) | |
download | vim-45600ce8f2bead069882032f992623cd5a799ca0.zip |
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)
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } /* |