Coverity: fix a few strncpy calls by using xstrlcpy

NOTE: the PR where we really try to get rid of strncpy is #743, this is just a smaller version to test how appeasing coverity works.

Fix some coverity warnings (see #760). Since this is mostly new code, I'd like for @tarruda to give it a small look as well.

@dougschneider If this is merged before your PR (which is likely, this is much smaller), you can just remove your commit that adds `xstrlcpy` and rebase :). Otherwise, I'll do the same.