Are there any free implementations of strcpy_s and/or TR24731-1?
Try with the Safe C library. It's under the MIT license and according to this list implements the functions you're looking for:
The Safe C Library provides bound checking memory and string functions per ISO/IEC TR24731. These functions are alternative functions to the existing standard C library that promote safer, more secure programming
You can use memcpy
and memset
etc, which are portable and safer than string functions.
Why not using strncpy
and strncat
? Contrary to strlcpy
and strlcat
, they are standard C functions. These functions are not perfect but you can use them safely.
And also note that the bounds-checking _s
functions are optional in the current Standard.