From nobody Mon May 13 00:19:20 2024 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=1695211559; cv=none; d=zohomail.com; s=zohoarc; b=QAeX599YGsre/MUVw9+3H/RCdCxcdbqppW4TSaPdGaPkAJ3aLpc9gtnkIYUZYHEu1wIw1ZyUv0633F8yQFOhQmUbbPnkSNlQqrO1nDtdmWN9kw76DwPCkjg2QYO2KoOksMhNvM0/GyWUFldS7nip1fN1/nyPGWRvTK/7Yl0Zycc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695211559; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=pff8iMl765k1TZvG6usJzRgCUJuJGfquQLjK3lTbzVg=; b=A9SJiDUWj9EXjazPFFpqJthE5WNuVPvGI8g+XhQdefZ/taK2CmkVaPzZY78wh4vw/jfKvzmAkUSZ4SAC+nm5gyBZ8LwiTTlMpshRLEsROdosDsJIXymMnb1Pk0bICZl4GzqrLQU3PJznLBEZAgCQ5NWtwV+BXXSxyulPXo32//o= 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 1695211559514266.2642070135388; Wed, 20 Sep 2023 05:05:59 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-uuepjLCfNV2RPQAkJWg5nw-1; Wed, 20 Sep 2023 08:05:56 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 122463C1ACEE; Wed, 20 Sep 2023 12:05:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D27EA492C37; Wed, 20 Sep 2023 12:05:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5C812194658F; Wed, 20 Sep 2023 12:05:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E533B194658D for ; Wed, 20 Sep 2023 12:01:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C58D540C6EBF; Wed, 20 Sep 2023 12:01:30 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.45.242.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A43840C6EC1 for ; Wed, 20 Sep 2023 12:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695211558; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pff8iMl765k1TZvG6usJzRgCUJuJGfquQLjK3lTbzVg=; b=jKKe4LT+F5koR8z9TUhTusts+2+BxHD2O0aNLNHm29fMMKZQ4MTQQBhv4dhgi0QUbjWEg9 gBwqbW2FLyIfaegKu6rwVDdwsc5Tw2mYGtf2CMXG9sTYxuLPQJ1aTDUnqcBErFRuLHVl/u 5YxehmTDth5UxJs/hXC8kcVpsL3mfOc= X-MC-Unique: uuepjLCfNV2RPQAkJWg5nw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu_nbdkit: fix possible null dereference Date: Wed, 20 Sep 2023 14:01:29 +0200 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1695211560442100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Function virGetConnectSecret() can return NULL so we need to check it since in virSecretGetSecretString() it gets dereferenced. Reported-by: coverity Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_nbdkit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index 66b09cd240..17819ca992 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -971,6 +971,9 @@ qemuNbdkitProcessBuildCommandAuth(virStorageAuthDef *au= thdef, } =20 conn =3D virGetConnectSecret(); + if (!conn) + return -1; + if (virSecretGetSecretString(conn, &authdef->seclookupdef, secrettype, --=20 2.41.0