Fixed potentially overlapping memcpy() to use memmove()

This commit is contained in:
Sam Lantinga committed 2025-01-14 14:31:20 -08:00
1 parent 191a6417d5
commit 49dd24e195
4 files changed
+4 -4

No files matched your search

+1 -1
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;