https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96951
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- With the exception of code that needs to ensure the rest of the buffer is filled with zeros (typically code dealing with passwords etc.), strncpy is pretty much never something one should use. Even the above example, if it is only meant to truncate and return -1 if it doesn't fit, but otherwise just copy the string, is wasting time on the extra clearing (sure, when it is just 10 bytes that isn't that big deal).