The size argument is the maximum number of bytes to copy, not the destination buffer size. Replace with utility function that joins strings.