New functions safe_strncat() and safe_strncpy() which always return a NUL terminated string and do not overflow the destination buffer.