The documentation for strncat
states:
src - pointer to the null-terminated byte string to copy from
Therefore, the implementation can assume that the src
input parameter is in fact NUL-terminated, even if it is longer than count
characters.
For further confirmation, Microsoft's own documentation states:
strSource
Null-terminated source string.
On the other hand, the actual C standard states something like:
The
strncat
function appends not more thann
characters (a null character and characters that follow it are not appended) from the array pointed to bys2
to the end of the string pointed to bys1
.
As pointed out in the comments below, this identifies the second parameter s2
as an array and not a NUL-terminated string. However, this is still ambiguous with respect to the original question, because this documentation describes the ultimate effect on s1
, rather than the behaviour of the function when reading from s2
.
This could of course be settled with respect to the specific Microsoft implementation by consulting the C Runtime Library source code.