How about using strlcpy() instead of invoking formatting !