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:
parent
fd40e4aa54
commit
89b7e089c4
@ -739,13 +739,13 @@ static char* absoluteFilename (const char *file)
|
|||||||
else if (cp [0] != '/')
|
else if (cp [0] != '/')
|
||||||
cp = slashp;
|
cp = slashp;
|
||||||
#endif
|
#endif
|
||||||
strcpy (cp, slashp + 3);
|
memmove (cp, slashp + 3, strlen (slashp + 3) + 1);
|
||||||
slashp = cp;
|
slashp = cp;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (slashp [2] == '/' || slashp [2] == '\0')
|
else if (slashp [2] == '/' || slashp [2] == '\0')
|
||||||
{
|
{
|
||||||
strcpy (slashp, slashp + 2);
|
memmove (slashp, slashp + 2, strlen (slashp + 2) + 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user