Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Except strncpy is broken for C strings, because it doesn't guarantee nul termination. So if you forget to force a termination on every use, you get buffer overruns.

Not only that, but (because of its actual purpose) it also fills the buffer with nuls, which is a complete waste of resources.

So yes, the original intent of strncpy() germane to the GPs comment, because it makes strncpy actively dangerous and complete shit when working with C strings.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: