Fix memcpy()s with overlapping buffers