Question: is strncpy safer than strcpy?
Answer: strncpy is NOT safer than strcpy, it just trades one type of bugs with another. In C, when handling C strings, you need to know the size of your buffers, there is no way around it. ... if you don't know the lengths, then you risk silently truncating your strings, which is not much better than a buffer overflow.