Fix for locking issues in redmine/6334

Please use strlcpy().  On truncation, it *does* '\0'-terminate, where strncpy does not; when it doesn't need all the space available, it doesn't waste time (as strncpy does) filling the rest of the space with more '\0' bytes beyond the one that's actually needed.