Fix invalid use of strcpy() on overlapping memory

strcpy()'s behavior on overlapping memory is undefined, so replace such
uses with memmove().

Based on CTags r783: https://ctags.svn.sourceforge.net/svnroot/ctags@783
This commit is contained in:
Colomban Wendling 2012-07-31 00:33:53 +02:00
parent fd40e4aa54
commit 89b7e089c4

View File

@ -739,13 +739,13 @@ static char* absoluteFilename (const char *file)
else if (cp [0] != '/')
cp = slashp;
#endif
strcpy (cp, slashp + 3);
memmove (cp, slashp + 3, strlen (slashp + 3) + 1);
slashp = cp;
continue;
}
else if (slashp [2] == '/' || slashp [2] == '\0')
{
strcpy (slashp, slashp + 2);
memmove (slashp, slashp + 2, strlen (slashp + 2) + 1);
continue;
}
}