3 ms·
The 'strn' functions are wrong, stop using them. https://randomascii.wordpress.com/2013/04/03/stop-using-strncpy-already/ https://randomascii.wordpress.com/201
by klodolph 11y ago
The 'strn' functions are wrong, stop using them.
https://randomascii.wordpress.com/2013/04/03/stop-using-strncpy-already/ https://randomascii.wordpress.com/2013/04/03/stop-using-strn...
- nitrogen 11y agostrncpy is fine if you wrap it with a length error check or explicit 0 terminator.
- raverbashing 11y agoThis 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