mem: fix bug with CopyStringOut and null string termination.