From 1081538c9f2903bec7ad003ab29fadd06bddc7b8 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 23 Oct 2011 11:59:52 +0800 Subject: [PATCH] Kernel - Fixed infinite loop in memmove (exposed by AcessNative's use of SDL) --- Kernel/lib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kernel/lib.c b/Kernel/lib.c index 6263dc8a..73b6432e 100644 --- a/Kernel/lib.c +++ b/Kernel/lib.c @@ -960,6 +960,9 @@ void *memmove(void *__dest, const void *__src, size_t len) char *dest = __dest; const char *src = __src; void *ret = __dest; + + if( len == 0 || dest == src ) + return dest; if( (tVAddr)dest > (tVAddr)src + len ) return memcpy(dest, src, len); -- 2.20.1