Use snprintf() instead of strlcpy()+strlcat().