Kernel - Fixed infinite loop in memmove (exposed by AcessNative's use of SDL)
authorJohn Hodge <[email protected]>
Sun, 23 Oct 2011 03:59:52 +0000 (11:59 +0800)
committerJohn Hodge <[email protected]>
Sun, 23 Oct 2011 03:59:52 +0000 (11:59 +0800)
Kernel/lib.c

index 6263dc8..73b6432 100644 (file)
@@ -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);

UCC git Repository :: git.ucc.asn.au