The newly allocated memory can not overlap with the string if the string
is properly null-terminated or the maxlen is a valid lengh. Prefer memcpy()
over memmove(), aka bcopy(), for slight performance gain.
No functional change intended.
MFC after: 2 weeks