Commit eb2bedc5 authored by Alexandre Julliard's avatar Alexandre Julliard

libport: Fixed invalid lvalue accesses in memmove.

parent 5d73cfda
...@@ -22,25 +22,26 @@ ...@@ -22,25 +22,26 @@
#include "wine/port.h" #include "wine/port.h"
#ifndef HAVE_MEMMOVE #ifndef HAVE_MEMMOVE
void *memmove( void *dest, const void *src, size_t len ) void *memmove( void *dest, const void *source, size_t len )
{ {
register char *dst = dest; register char *dst = dest;
register const char *src = source;
/* Use memcpy if not overlapping */ /* Use memcpy if not overlapping */
if ((dst + len <= (char *)src) || ((char *)src + len <= dst)) if ((dst + len <= src) || (src + len <= dst))
{ {
memcpy( dst, src, len ); memcpy( dst, src, len );
} }
/* Otherwise do it the hard way (FIXME: could do better than this) */ /* Otherwise do it the hard way (FIXME: could do better than this) */
else if (dst < (char *)src) else if (dst < src)
{ {
while (len--) *dst++ = *((char *)src)++; while (len--) *dst++ = *src++;
} }
else else
{ {
dst += len - 1; dst += len - 1;
src = (char *)src + len - 1; src += len - 1;
while (len--) *dst-- = *((char *)src)--; while (len--) *dst-- = *src--;
} }
return dest; return dest;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment