From nobody Tue May 13 18:51:29 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153426648670887.92433534424788; Tue, 14 Aug 2018 10:08:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82CDC308626C; Tue, 14 Aug 2018 17:08:03 +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 EDD8C94E02; Tue, 14 Aug 2018 17:08:02 +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 048C24A465; Tue, 14 Aug 2018 17:08:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7EH7wmk003272 for ; Tue, 14 Aug 2018 13:07:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE10D5D9C5; Tue, 14 Aug 2018 17:07:58 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-116-168.phx2.redhat.com [10.3.116.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D2647A4FF for ; Tue, 14 Aug 2018 17:07:58 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 14 Aug 2018 13:07:46 -0400 Message-Id: <20180814170756.19205-2-jferlan@redhat.com> In-Reply-To: <20180814170756.19205-1-jferlan@redhat.com> References: <20180814170756.19205-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/11] util: Alter virAuthGet*Path API to check valid parameters 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 14 Aug 2018 17:08:04 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Before trying to dereference @auth, let's ensure it's valid. Signed-off-by: John Ferlan --- src/util/virauth.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util/virauth.c b/src/util/virauth.c index 759b8f0cd3..1b9e4b6704 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -153,6 +153,12 @@ virAuthGetUsernamePath(const char *path, if (ret !=3D NULL) return ret; =20 + if (!auth) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Missing authentication credentials")); + return NULL; + } + memset(&cred, 0, sizeof(virConnectCredential)); =20 if (defaultUsername !=3D NULL) { @@ -226,6 +232,12 @@ virAuthGetPasswordPath(const char *path, if (ret !=3D NULL) return ret; =20 + if (!auth) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Missing authentication credentials")); + return NULL; + } + memset(&cred, 0, sizeof(virConnectCredential)); =20 if (virAsprintf(&prompt, _("Enter %s's password for %s"), username, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list