From nobody Tue Sep 9 19:00:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1748855034; cv=none; d=zohomail.com; s=zohoarc; b=Z1VUGCurhfMLqTSx22SdSdREjW36+i53dXOIlO+ZG0bxU0yyXW6xwE0LzBRj7gkedcgmozogCw/RysB9AUzjhcNSCoX4csp1V5VO2pqAieoxtrCccrgTTlV4nEGYw5+G8UhVi2qXo2bm+d7Qo/OR+Vzvu5zgtPyTvGkomrIBmYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748855034; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=ORVm0j1rVO14oj+wLb/L/rV7LP+n32YfF0K2LWmFZjw=; b=DXm/VnHUD2QTesJ55nKpAO8NaTMd6E5ghoyyJedD8rRC5qdRn8lgmLks6yF2/k7PpgRXXX3qncSnu7w/YOgw9v0mBpUiYJKEVFAtxcxN82wZjcCLJPrJ1hUjNR3cZoOwWbdP2USrgJOAIwZMCmUF3iJAS5kszuJj4YqEDLBi0S0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1748855034369612.942282326447; Mon, 2 Jun 2025 02:03:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 69D88136B; Mon, 2 Jun 2025 05:03:53 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D4B7F12D1; Mon, 2 Jun 2025 05:03:35 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EADC3127F; Mon, 2 Jun 2025 05:03:32 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E2F1FDB5 for ; Mon, 2 Jun 2025 05:03:30 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-XbyU-vRVMJuxnqPjnmEr8g-1; Mon, 02 Jun 2025 05:03:29 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BF2381800360 for ; Mon, 2 Jun 2025 09:03:28 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.44.22.3]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 00AF71954191 for ; Mon, 2 Jun 2025 09:03:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748855010; h=from:from: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; bh=P65X0eAz4LHhP+dTCkzpKlSns/+sO1tjnhcxOxwJVzI=; b=fUooOHjWrRDLBByqE/erhf0RNnJee8u3cUE+f/O6PiT70w0rZWrzsowiggot73DDIFovIT xmTB7oZvuxxJMAFXRZVxxQlmfB4RlRnpsXnME69Da5vRL/NFX6b/I5QZdcYV7461Z7SYK6 jJ4X2+eeA3989nctLk9X1qVOK4IT3mA= X-MC-Unique: XbyU-vRVMJuxnqPjnmEr8g-1 X-Mimecast-MFC-AGG-ID: XbyU-vRVMJuxnqPjnmEr8g_1748855008 To: devel@lists.libvirt.org Subject: [PATCH] esx: Avoid corner case where esxUtil_ParseDatastorePath could be called with NULL 'datastorePath' Date: Mon, 2 Jun 2025 11:03:26 +0200 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: CPLdSG0B896RPJrNtYbAZd7WwskewccXlw2PQCwqsWY_1748855008 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7RE2OJK4TX7O6ICVZNIURRRS3FSUNKVQ X-Message-ID-Hash: 7RE2OJK4TX7O6ICVZNIURRRS3FSUNKVQ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1748855036865116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The generated code which parses the data from XML in esxVI_LookupDatastoreContentByDatastoreName can fill the 'folderPath' property with NULL if it were missing from the input XML. While this is not likely when talking to esx it is a possible outcome. Skipp NULL results. All other code paths already ensure that the function is not called with NULL. Closes: https://gitlab.com/libvirt/libvirt/-/issues/776 Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/esx/esx_storage_backend_vmfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backe= nd_vmfs.c index 145aff0c9c..8e13201fe2 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -616,6 +616,9 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char = **const names, searchResults =3D searchResults->_next) { g_autofree char *directoryAndFileName =3D NULL; + if (!searchResults->folderPath) + continue; + if (esxUtil_ParseDatastorePath(searchResults->folderPath, NULL, NU= LL, &directoryAndFileName) < 0) { goto cleanup; @@ -759,6 +762,9 @@ esxStorageVolLookupByKey(virConnectPtr conn, const char= *key) searchResults =3D searchResults->_next) { g_autofree char *directoryAndFileName =3D NULL; + if (searchResults->folderPath) + continue; + if (esxUtil_ParseDatastorePath(searchResults->folderPath, NULL, NULL, &directoryAndFileName) < = 0) { goto cleanup; --=20 2.49.0