[NTOSKRNL] Replace overlapping strcopy with memmove

Fixes 4 GCC 8 warnings of the kind:
ntoskrnl/kdbg/kdb_cli.c:3015:21: error: 'strcpy' accessing 1 byte at offsets 0 and [0, 2147483647] may overlap 1 byte at offset 0 [-Werror=restrict]
                     strcpy(p2, p2 + j);
                     ^~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-28 20:23:35 +02:00
parent 95b3eebf71
commit 3af7cb825f

View file

@ -2662,15 +2662,16 @@ KdbpPrint(
{
while ((p2 = strrchr(p, '\x1b'))) /* Look for escape character */
{
size_t len = strlen(p2);
if (p2[1] == '[')
{
j = 2;
while (!isalpha(p2[j++]));
strcpy(p2, p2 + j);
memmove(p2, p2 + j, len + 1 - j);
}
else
{
strcpy(p2, p2 + 1);
memmove(p2, p2 + 1, len);
}
}
}
@ -3007,15 +3008,16 @@ KdbpPager(
{
while ((p2 = strrchr(p, '\x1b'))) /* Look for escape character */
{
size_t len = strlen(p2);
if (p2[1] == '[')
{
j = 2;
while (!isalpha(p2[j++]));
strcpy(p2, p2 + j);
memmove(p2, p2 + j, len + 1 - j);
}
else
{
strcpy(p2, p2 + 1);
memmove(p2, p2 + 1, len);
}
}
}