strncpy is horrid: as you've noticed, when there's not enough space it neglects to '\0'-terminate; but, when there's surplus space, it '\0'-fills all of the surplus, it doesn't just append one !  Something like <code>
size_t len = strlen(ip->name);
if (len >= CF_BUFSIZE) { len = CF_BUFSIZE - 1; }
memcpy(line_buff, ip->name, len);
line_buff[len] = '\0';
</code> is my suggestion for this.  Then again, this is almost exactly strlcpy() and I'm still too new here to know whether that's available.