Skip to content
Permalink
Browse files

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)
  • Loading branch information...
brammool committed Jan 27, 2017
1 parent aed6d0b commit 45600ce8f2bead069882032f992623cd5a799ca0
Showing with 4 additions and 2 deletions.
  1. +2 −2 src/misc2.c
  2. +2 −0 src/version.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);
}

/*
@@ -764,6 +764,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
248,
/**/
247,
/**/

0 comments on commit 45600ce

Please sign in to comment.
You can’t perform that action at this time.