Replace strncpy with snprintf or strlcpy