...
Either the strcpy()
or strncpy()
function can be used to copy a string and a null character to a destination buffer, provided there is enough space. Care must be taken to ensure that the destination buffer is large enough to hold the string to be copied and the NULL null byte to prevent errors such as data truncation and buffer overflow.
...
It is assumed that string_data
is NULL null-terminated, that is, a NULL null byte can be found within the bounds of the referenced character array. Otherwise, strlen()
will stray into other objects before finding a NULL null byte.
Compliant Solution (TR 24731-1)
...