From nobody Sun Feb 8 22:07:45 2026 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 15541239460901017.273853072003; Mon, 1 Apr 2019 06:05:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B98EC074EFF; Mon, 1 Apr 2019 13:05:44 +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 4D9995C21E; Mon, 1 Apr 2019 13:05:44 +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 F3A673FAF4; Mon, 1 Apr 2019 13:05:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31D5KEu016068 for ; Mon, 1 Apr 2019 09:05:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1CBA8108BEF0; Mon, 1 Apr 2019 13:05:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 944801001DD1 for ; Mon, 1 Apr 2019 13:05:19 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 1 Apr 2019 15:05:00 +0200 Message-Id: <9b7b695d67c9005bb7140af03fb289eca617be7a.1554123828.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/10] util: json: Make sure that Jano's pin is not leaked to the heap 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 01 Apr 2019 13:05:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use virPinIsJanos and clear the string if it accidentally contains Jano's PIN. --- src/Makefile.am | 3 +++ src/util/virjson.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index a73f43c483..621c5ff224 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -683,6 +683,7 @@ libvirt_setuid_rpc_client_la_SOURCES =3D \ util/virlog.c \ util/virobject.c \ util/virpidfile.c \ + util/virpin.c \ util/virprocess.c \ util/virrandom.c \ util/virsocketaddr.c \ @@ -890,6 +891,8 @@ libvirt_nss_la_SOURCES =3D \ util/virhashcode.h \ util/virjson.c \ util/virjson.h \ + util/virpin.c \ + util/virpin.h \ util/virkmod.c \ util/virkmod.h \ util/virlease.c \ diff --git a/src/util/virjson.c b/src/util/virjson.c index d5d66f879f..7a52493c62 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -28,6 +28,7 @@ #include "virlog.h" #include "virstring.h" #include "virutil.h" +#include "virpin.h" #if WITH_YAJL # include @@ -426,7 +427,10 @@ virJSONValueFree(virJSONValuePtr value) VIR_FREE(value->data.string); break; case VIR_JSON_TYPE_NUMBER: - VIR_FREE(value->data.number); + if (virPinIsJanos(value->data.number)) + VIR_DISPOSE_STRING(value->data.number); + else + VIR_FREE(value->data.number); break; case VIR_JSON_TYPE_BOOLEAN: case VIR_JSON_TYPE_NULL: --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list