Use memmove() instead of memcpy() for a case where the buffers overlap.