We have `strlcpy` for such operations, moreover strlen is calculated twice which could be reconsidered to use some intermediate variable.