static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,
				    const unsigned char *name, size_t namelen)
	{
	char *copy;
	if (namelen == 0)
		namelen = name ? strlen((char *)name) : 0;
	else if (name && memchr(name, '\0', namelen > 1 ? namelen-1 : namelen))
		 return 0;
	if (name && name[namelen-1] == '\0')
		--namelen;
	if (mode == SET_HOST && id->hosts)
		{
		string_stack_free(id->hosts);
		id->hosts = NULL;
		}
	if (name == NULL || namelen == 0)
		return 1;
	copy = BUF_strndup((char *)name, namelen);
	if (copy == NULL)
		return 0;
	if (id->hosts == NULL &&
	    (id->hosts = sk_OPENSSL_STRING_new_null()) == NULL)
		{
		OPENSSL_free(copy);
		return 0;
		}
	if (!sk_OPENSSL_STRING_push(id->hosts, copy))
		{
		OPENSSL_free(copy);
		if (sk_OPENSSL_STRING_num(id->hosts) == 0)
			{
			sk_OPENSSL_STRING_free(id->hosts);
			id->hosts = NULL;
			}
		return 0;
		}
	return 1;
	}
["static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,\n\t\t\t\t    const unsigned char *name, size_t namelen)\n\t{\n\tchar *copy;\n\tif (namelen == 0)\n\t\tnamelen = name ? strlen((char *)name) : 0;\n\telse if (name && memchr(name, '\\0', namelen > 1 ? namelen-1 : namelen))\n\t\t return 0;\n\tif (name && name[namelen-1] == '\\0')\n\t\t--namelen;\n\tif (mode == SET_HOST && id->hosts)\n\t\t{\n\t\tstring_stack_free(id->hosts);\n\t\tid->hosts = NULL;\n\t\t}\n\tif (name == NULL || namelen == 0)\n\t\treturn 1;\n\tcopy = BUF_strndup((char *)name, namelen);\n\tif (copy == NULL)\n\t\treturn 0;\n\tif (id->hosts == NULL &&\n\t    (id->hosts = sk_OPENSSL_STRING_new_null()) == NULL)\n\t\t{\n\t\tOPENSSL_free(copy);\n\t\treturn 0;\n\t\t}\n\tif (!sk_OPENSSL_STRING_push(id->hosts, copy))\n\t\t{\n\t\tOPENSSL_free(copy);\n\t\tif (sk_OPENSSL_STRING_num(id->hosts) == 0)\n\t\t\t{\n\t\t\tsk_OPENSSL_STRING_free(id->hosts);\n\t\t\tid->hosts = NULL;\n\t\t\t}\n\t\treturn 0;\n\t\t}\n\treturn 1;\n\t}"]