C
CBFalconer
.... snip ...
It's strncpy that doesn't give a terminating '\0'; strncat copies
at most count characters from the source string to the end of the
dest string and then adds a '\0'. (I *did* say that it was
confusing. I had to check the man page to see which strncat was.
I just checked N1124, and it agrees with the man page (7.21.3.2).)
I suggest ignoring strncpy and its nuisances, and using strlcpy and
strlcat. These names are reserved, but you can change them.
Source code in standard C, and full documentation, are all
available at:
<http://cbfalconer.home.att.net/download/strlcpy.zip>