Avoid memcpy on overlapping memory
Merge pull request #1358 from manisandro/memcpy_overlapping

Avoid memcpy on overlapping memory