mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 11:32:56 +00:00
[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:
parent
95b3eebf71
commit
3af7cb825f
1 changed files with 6 additions and 4 deletions
|
@ -2662,15 +2662,16 @@ KdbpPrint(
|
||||||
{
|
{
|
||||||
while ((p2 = strrchr(p, '\x1b'))) /* Look for escape character */
|
while ((p2 = strrchr(p, '\x1b'))) /* Look for escape character */
|
||||||
{
|
{
|
||||||
|
size_t len = strlen(p2);
|
||||||
if (p2[1] == '[')
|
if (p2[1] == '[')
|
||||||
{
|
{
|
||||||
j = 2;
|
j = 2;
|
||||||
while (!isalpha(p2[j++]));
|
while (!isalpha(p2[j++]));
|
||||||
strcpy(p2, p2 + j);
|
memmove(p2, p2 + j, len + 1 - j);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(p2, p2 + 1);
|
memmove(p2, p2 + 1, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3007,15 +3008,16 @@ KdbpPager(
|
||||||
{
|
{
|
||||||
while ((p2 = strrchr(p, '\x1b'))) /* Look for escape character */
|
while ((p2 = strrchr(p, '\x1b'))) /* Look for escape character */
|
||||||
{
|
{
|
||||||
|
size_t len = strlen(p2);
|
||||||
if (p2[1] == '[')
|
if (p2[1] == '[')
|
||||||
{
|
{
|
||||||
j = 2;
|
j = 2;
|
||||||
while (!isalpha(p2[j++]));
|
while (!isalpha(p2[j++]));
|
||||||
strcpy(p2, p2 + j);
|
memmove(p2, p2 + j, len + 1 - j);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(p2, p2 + 1);
|
memmove(p2, p2 + 1, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue