From 644614cdd8f63727adb1e5acc98784e7a0e6b4f0 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 11 Feb 2024 17:08:36 +0100 Subject: [PATCH] libluna: Fix memmove when dest > src Really? A crucial component of the libc was broken? No wonder some ports did not work very well... --- libluna/src/CString.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libluna/src/CString.cpp b/libluna/src/CString.cpp index 84a1f379..249bd774 100644 --- a/libluna/src/CString.cpp +++ b/libluna/src/CString.cpp @@ -51,7 +51,7 @@ extern "C" { if (dest == src) return dest; if (dest > src) - for (long i = (long)n - 1; i >= 0; i++) { *((u8*)dest + i) = *((const u8*)src + i); } + for (long i = (long)n - 1; i >= 0; i--) { *((u8*)dest + i) = *((const u8*)src + i); } else for (long i = 0; i < (long)n; i++) { *((u8*)dest + i) = *((const u8*)src + i); } return dest;