On Thu, Apr 19, 2012 at 02:01:36PM +0200, Richard Guenther wrote:
> strncpy -> strcpy definitely looks like premature optimization to me.

I disagree.  Almost all uses of strncpy are wrong.  If the string length is
smaller, than it is unlikely useful that it clears all remaining bytes
(sometimes many of them) - exception might be security sensitive code,
if the string length is known to be sizeof buf - 1, then strcpy or even
memcpy should be used, and if the string length is larger, then no '\0' is
appended, so it is unlikely the right thing.

Yes, Jim should probably add a comment.

        Jakub

Reply via email to