sandbox: Use memmove() to move overlapping regions