Avoid measuring the length of the string again, just copy it directly into the buffer instead using `.copy()`