Fixed potentially overlapping memcpy() to use memmove()

This commit is contained in:
Sam Lantinga
2025-01-14 14:31:20 -08:00
parent 191a6417d5
commit 49dd24e195
4 changed files with 4 additions and 4 deletions

View File

@@ -123,7 +123,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char
if (newline) {
if (textwin->current == textwin->numlines - 1) {
SDL_free(textwin->lines[0]);
SDL_memcpy(&textwin->lines[0], &textwin->lines[1], (textwin->numlines - 1) * sizeof(textwin->lines[1]));
SDL_memmove(&textwin->lines[0], &textwin->lines[1], (textwin->numlines - 1) * sizeof(textwin->lines[1]));
textwin->lines[textwin->current] = NULL;
} else {
++textwin->current;