Comment Comment by gp7 Two years after this post, the Linux kernel added strscpy, the api of which is equivalent to the safe strncpy in this post. Internally, it stops copying once it reaches the null terminator.https://lwn.net/Articles/659214/ parent gp7 8 years ago
https://lwn.net/Articles/659214/