News for hackers. Stuff that matters.
Re:How to C in 2016 by klodolph on Friday January 08, 2016 @05:21PM (#10868761)
The 'strn' functions are wrong, stop using them.

https://randomascii.wordpress.com/2013/04/03/stop-using-strn...

Re:How to C in 2016 by raverbashing on Saturday January 09, 2016 @03:11AM (#10870508)
This solution uses templates, which are C++, not C

But if you're using C++, use C++ strings, you don't need strcpy

There's strlcpy mentioned there, which seems a better C solution

Re:How to C in 2016 by nitrogen on Friday January 08, 2016 @06:49PM (#10869213)
strncpy is fine if you wrap it with a length error check or explicit 0 terminator.