From nobody Sat Feb 7 06:49:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637601207; cv=none; d=zohomail.com; s=zohoarc; b=WRsURhIMFrGJ9rWJoOrbLC/pQkoWiE4gZkcRSYv+/n0KdK/zkp75Aixnf4usUjQlG7dBo1hYCU8JBF3haQzowr9fxThiD68B/ghFgWcgKcXRbBEVQFkgJJpFW0cB55mIeAgwF+nJQXTQAMdQLZxMXqRD2CJBpMB7w5ii+6r2YZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637601207; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=j946aY8XA/FyqVt34yGwyeJF+jQkXjOD2QXzG4kjO64=; b=kYdMQff410mWkYhVIDCqLK1W64z1ocexJ39CMlotVU+zgu6dIsOXY5aX7SKWE8vneRoyCUrK1LRN5Wwf4jfqeRsXhjHv393zEKhSmKmZEnvwEdBqyn67h260ETVQz7a1ei+hud7WI6xiBz5OR5kHtOWJ+62IfGkBE1xKKjwR3+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1637601207655124.26781843759215; Mon, 22 Nov 2021 09:13:27 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-h13XwIpnNqyQv4JXBcIiTA-1; Mon, 22 Nov 2021 12:13:22 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CAC4CDF8A6; Mon, 22 Nov 2021 17:13:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B170460BD8; Mon, 22 Nov 2021 17:13:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7F72E4EA37; Mon, 22 Nov 2021 17:13:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AMHCnFP029392 for ; Mon, 22 Nov 2021 12:12:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id DB5FB60C7F; Mon, 22 Nov 2021 17:12:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FEA160C5F for ; Mon, 22 Nov 2021 17:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637601206; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=j946aY8XA/FyqVt34yGwyeJF+jQkXjOD2QXzG4kjO64=; b=JR7cly+2vJG8gPxaCXn2vknNyFQoHqGrseRk1ThWDo0718OvxL5SJRDn9eRhN8dZcQ2dxS brbBJtUfymtWX4p/T9BVtNgws8vLOZpAc8DXKZgANs5wfkXhmCF35R9ytDKpRjqTU+aOAL qAMhX0KVGyIezqygka16tq5tKjUuhrU= X-MC-Unique: h13XwIpnNqyQv4JXBcIiTA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/12] util: xml: Remove virXMLPropStringLimit and virXPathStringLimit Date: Mon, 22 Nov 2021 18:12:32 +0100 Message-Id: <852a9d6f2428f3487be992bd010b23c4b3b7ba14.1637600984.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637601208459100001 Content-Type: text/plain; charset="utf-8" The functions have very difficult semantics where callers are not able to tell whether the property is missing or failed the length check. Only the latter produces errors. Since usage of the functions was phased out, remove them completely to avoid further broken code. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 2 -- src/util/virxml.c | 62 ---------------------------------------- src/util/virxml.h | 8 ------ 3 files changed, 72 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a7bc50a4d1..13b7266c97 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3625,7 +3625,6 @@ virXMLPropEnum; virXMLPropEnumDefault; virXMLPropInt; virXMLPropString; -virXMLPropStringLimit; virXMLPropTristateBool; virXMLPropTristateSwitch; virXMLPropUInt; @@ -3646,7 +3645,6 @@ virXPathNode; virXPathNodeSet; virXPathNumber; virXPathString; -virXPathStringLimit; virXPathUInt; virXPathULong; virXPathULongHex; diff --git a/src/util/virxml.c b/src/util/virxml.c index b736d59d9c..4b09374107 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -89,45 +89,6 @@ virXPathString(const char *xpath, } -static char * -virXMLStringLimitInternal(char *value, - size_t maxlen, - const char *name) -{ - if (value !=3D NULL && strlen(value) >=3D maxlen) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("'%s' value longer than '%zu' bytes"), - name, maxlen); - VIR_FREE(value); - return NULL; - } - - return value; -} - - -/** - * virXPathStringLimit: - * @xpath: the XPath string to evaluate - * @maxlen: maximum length permitted string - * @ctxt: an XPath context - * - * Wrapper for virXPathString, which validates the length of the returned - * string. - * - * Returns a new string which must be deallocated by the caller or NULL if - * the evaluation failed. - */ -char * -virXPathStringLimit(const char *xpath, - size_t maxlen, - xmlXPathContextPtr ctxt) -{ - char *tmp =3D virXPathString(xpath, ctxt); - - return virXMLStringLimitInternal(tmp, maxlen, xpath); -} - /** * virXPathNumber: * @xpath: the XPath string to evaluate @@ -492,29 +453,6 @@ virXMLPropString(xmlNodePtr node, } -/** - * virXMLPropStringLimit: - * @node: XML dom node pointer - * @name: Name of the property (attribute) to get - * @maxlen: maximum permitted length of the string - * - * Wrapper for virXMLPropString, which validates the length of the returned - * string. - * - * Returns a new string which must be deallocated by the caller or NULL if - * the evaluation failed. - */ -char * -virXMLPropStringLimit(xmlNodePtr node, - const char *name, - size_t maxlen) -{ - char *tmp =3D (char *)xmlGetProp(node, BAD_CAST name); - - return virXMLStringLimitInternal(tmp, maxlen, name); -} - - /** * virXMLNodeContentString: * @node: XML dom node pointer diff --git a/src/util/virxml.h b/src/util/virxml.h index 06fb7aebd8..6f9f217f73 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -47,10 +47,6 @@ virXPathBoolean(const char *xpath, char * virXPathString(const char *xpath, xmlXPathContextPtr ctxt); -char * -virXPathStringLimit(const char *xpath, - size_t maxlen, - xmlXPathContextPtr ctxt); int virXPathNumber(const char *xpath, xmlXPathContextPtr ctxt, @@ -98,10 +94,6 @@ char * virXMLPropString(xmlNodePtr node, const char *name); char * -virXMLPropStringLimit(xmlNodePtr node, - const char *name, - size_t maxlen); -char * virXMLNodeContentString(xmlNodePtr node); int --=20 2.31.1