From nobody Wed May 1 02:04:55 2024 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 153747932383998.89173042249172; Thu, 20 Sep 2018 14:35:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 40EB481106; Thu, 20 Sep 2018 21:35:21 +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 DFE3385A5D; Thu, 20 Sep 2018 21:35:20 +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 746A44BB75; Thu, 20 Sep 2018 21:35:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8KLYi5W004505 for ; Thu, 20 Sep 2018 17:34:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9545E3091385; Thu, 20 Sep 2018 21:34:44 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-55.phx2.redhat.com [10.3.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50784309137F for ; Thu, 20 Sep 2018 21:34:44 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:34:36 -0400 Message-Id: <20180920213438.6412-2-jferlan@redhat.com> In-Reply-To: <20180920213438.6412-1-jferlan@redhat.com> References: <20180920213438.6412-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] conf: Alter when ctxt->node is set 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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 20 Sep 2018 21:35:22 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In virDomainMemoryDefParseXML and virDomainVideoDefParseXML if the VIR_ALLOC fails and NULL is returned, then the alteration to ctxt->node isn't reversed. Found by Coverity Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1ee43950ae..9911d56130 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15089,11 +15089,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr x= mlopt, char *vgamem =3D NULL; char *primary =3D NULL; =20 - ctxt->node =3D node; - if (!(def =3D virDomainVideoDefNew())) return NULL; =20 + ctxt->node =3D node; + cur =3D node->children; while (cur !=3D NULL) { if (cur->type =3D=3D XML_ELEMENT_NODE) { @@ -15830,11 +15830,11 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr = xmlopt, virDomainMemoryDefPtr def; int val; =20 - ctxt->node =3D memdevNode; - if (VIR_ALLOC(def) < 0) return NULL; =20 + ctxt->node =3D memdevNode; + if (!(tmp =3D virXMLPropString(memdevNode, "model"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing memory model")); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 02:04:55 2024 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 1537479296971699.0114264176577; Thu, 20 Sep 2018 14:34:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BCF281F0C; Thu, 20 Sep 2018 21:34:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5441585A5F; Thu, 20 Sep 2018 21:34:52 +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 A0A61181A12E; Thu, 20 Sep 2018 21:34:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8KLYjC0004510 for ; Thu, 20 Sep 2018 17:34:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 29D1E3091385; Thu, 20 Sep 2018 21:34:45 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-55.phx2.redhat.com [10.3.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id C25DC309137F for ; Thu, 20 Sep 2018 21:34:44 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:34:37 -0400 Message-Id: <20180920213438.6412-3-jferlan@redhat.com> In-Reply-To: <20180920213438.6412-1-jferlan@redhat.com> References: <20180920213438.6412-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] lxc: Resolve memory leak 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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 20 Sep 2018 21:34:55 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 40b5c99a modified the virConfGetValue callers to use virConfGetValueString. However, using the virConfGetValueString resulted in leaking the returned @value string in each case. So, let's modify each instance to use the VIR_AUTOFREE(char *) syntax. In some instances changing the variable name since @value was used more than once. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Erik Skultety --- src/lxc/lxc_native.c | 110 +++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 47 deletions(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index e1992fd1f9..6c5640536b 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -198,7 +198,7 @@ lxcSetRootfs(virDomainDefPtr def, virConfPtr properties) { int type =3D VIR_DOMAIN_FS_TYPE_MOUNT; - char *value =3D NULL; + VIR_AUTOFREE(char *) value =3D NULL; =20 if (virConfGetValueString(properties, "lxc.rootfs", &value) <=3D 0) return -1; @@ -679,7 +679,7 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfP= tr properties) static int lxcCreateConsoles(virDomainDefPtr def, virConfPtr properties) { - char *value =3D NULL; + VIR_AUTOFREE(char *) value =3D NULL; int nbttys =3D 0; virDomainChrDefPtr console; size_t i; @@ -756,14 +756,20 @@ lxcIdmapWalkCallback(const char *name, virConfValuePt= r value, void *data) static int lxcSetMemTune(virDomainDefPtr def, virConfPtr properties) { - char *value =3D NULL; + VIR_AUTOFREE(char *) hard_limit =3D NULL; + VIR_AUTOFREE(char *) soft_limit =3D NULL; + VIR_AUTOFREE(char *) swap_hard_limit =3D NULL; unsigned long long size =3D 0; =20 if (virConfGetValueString(properties, "lxc.cgroup.memory.limit_in_bytes", - &value) > 0) { - if (lxcConvertSize(value, &size) < 0) - goto error; + &hard_limit) > 0) { + if (lxcConvertSize(hard_limit, &size) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse integer: '%s'"), + hard_limit); + return -1; + } size =3D size / 1024; virDomainDefSetMemoryTotal(def, size); def->mem.hard_limit =3D virMemoryLimitTruncate(size); @@ -771,76 +777,85 @@ lxcSetMemTune(virDomainDefPtr def, virConfPtr propert= ies) =20 if (virConfGetValueString(properties, "lxc.cgroup.memory.soft_limit_in_bytes", - &value) > 0) { - if (lxcConvertSize(value, &size) < 0) - goto error; + &soft_limit) > 0) { + if (lxcConvertSize(soft_limit, &size) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse integer: '%s'"), + soft_limit); + return -1; + } def->mem.soft_limit =3D virMemoryLimitTruncate(size / 1024); } =20 if (virConfGetValueString(properties, "lxc.cgroup.memory.memsw.limit_in_bytes", - &value) > 0) { - if (lxcConvertSize(value, &size) < 0) - goto error; + &swap_hard_limit) > 0) { + if (lxcConvertSize(swap_hard_limit, &size) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse integer: '%s'"), + swap_hard_limit); + return -1; + } def->mem.swap_hard_limit =3D virMemoryLimitTruncate(size / 1024); } return 0; - - error: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to parse integer: '%s'"), value); - return -1; - } =20 static int lxcSetCpuTune(virDomainDefPtr def, virConfPtr properties) { - char *value =3D NULL; + VIR_AUTOFREE(char *) shares =3D NULL; + VIR_AUTOFREE(char *) quota =3D NULL; + VIR_AUTOFREE(char *) period =3D NULL; =20 if (virConfGetValueString(properties, "lxc.cgroup.cpu.shares", - &value) > 0) { - if (virStrToLong_ull(value, NULL, 10, &def->cputune.shares) < 0) - goto error; + &shares) > 0) { + if (virStrToLong_ull(shares, NULL, 10, &def->cputune.shares) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse integer: '%s'"), shares); + return -1; + } def->cputune.sharesSpecified =3D true; } =20 if (virConfGetValueString(properties, "lxc.cgroup.cpu.cfs_quota_us", - &value) > 0) { - if (virStrToLong_ll(value, NULL, 10, &def->cputune.quota) < 0) - goto error; + "a) > 0) { + if (virStrToLong_ll(quota, NULL, 10, &def->cputune.quota) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse integer: '%s'"), quota); + return -1; + } } =20 if (virConfGetValueString(properties, "lxc.cgroup.cpu.cfs_period_us", - &value) > 0) { - if (virStrToLong_ull(value, NULL, 10, &def->cputune.period) < 0) - goto error; + &period) > 0) { + if (virStrToLong_ull(period, NULL, 10, &def->cputune.period) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse integer: '%s'"), period); + return -1; + } } =20 return 0; - - error: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to parse integer: '%s'"), value); - return -1; } =20 static int lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties) { - char *value =3D NULL; + VIR_AUTOFREE(char *) cpus =3D NULL; + VIR_AUTOFREE(char *) mems =3D NULL; virBitmapPtr nodeset =3D NULL; =20 if (virConfGetValueString(properties, "lxc.cgroup.cpuset.cpus", - &value) > 0) { - if (virBitmapParse(value, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) <= 0) + &cpus) > 0) { + if (virBitmapParse(cpus, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < = 0) return -1; def->placement_mode =3D VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC; } =20 if (virConfGetValueString(properties, "lxc.cgroup.cpuset.mems", - &value) > 0) { - if (virBitmapParse(value, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0) + &mems) > 0) { + if (virBitmapParse(mems, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0) return -1; if (virDomainNumatuneSet(def->numa, def->placement_mode =3D=3D @@ -949,7 +964,7 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfVal= uePtr value, void *data) static int lxcSetBlkioTune(virDomainDefPtr def, virConfPtr properties) { - char *value =3D NULL; + VIR_AUTOFREE(char *) value =3D NULL; =20 if (virConfGetValueString(properties, "lxc.cgroup.blkio.weight", &value) > 0) { @@ -969,7 +984,7 @@ lxcSetBlkioTune(virDomainDefPtr def, virConfPtr propert= ies) static void lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties) { - char *value =3D NULL; + VIR_AUTOFREE(char *) value =3D NULL; char **toDrop =3D NULL; const char *capString; size_t i; @@ -996,7 +1011,8 @@ lxcParseConfigString(const char *config, { virDomainDefPtr vmdef =3D NULL; virConfPtr properties =3D NULL; - char *value =3D NULL; + VIR_AUTOFREE(char *) lxcarch =3D NULL; + VIR_AUTOFREE(char *) lxcutsname =3D NULL; =20 if (!(properties =3D virConfReadString(config, VIR_CONF_FLAG_LXC_FORMA= T))) return NULL; @@ -1029,11 +1045,11 @@ lxcParseConfigString(const char *config, vmdef->nfss =3D 0; vmdef->os.type =3D VIR_DOMAIN_OSTYPE_EXE; =20 - if (virConfGetValueString(properties, "lxc.arch", &value) > 0) { - virArch arch =3D virArchFromString(value); - if (arch =3D=3D VIR_ARCH_NONE && STREQ(value, "x86")) + if (virConfGetValueString(properties, "lxc.arch", &lxcarch) > 0) { + virArch arch =3D virArchFromString(lxcarch); + if (arch =3D=3D VIR_ARCH_NONE && STREQ(lxcarch, "x86")) arch =3D VIR_ARCH_I686; - else if (arch =3D=3D VIR_ARCH_NONE && STREQ(value, "amd64")) + else if (arch =3D=3D VIR_ARCH_NONE && STREQ(lxcarch, "amd64")) arch =3D VIR_ARCH_X86_64; vmdef->os.arch =3D arch; } @@ -1041,8 +1057,8 @@ lxcParseConfigString(const char *config, if (VIR_STRDUP(vmdef->os.init, "/sbin/init") < 0) goto error; =20 - if (virConfGetValueString(properties, "lxc.utsname", &value) <=3D 0 || - VIR_STRDUP(vmdef->name, value) < 0) + if (virConfGetValueString(properties, "lxc.utsname", &lxcutsname) <=3D= 0 || + VIR_STRDUP(vmdef->name, lxcutsname) < 0) goto error; if (!vmdef->name && (VIR_STRDUP(vmdef->name, "unnamed") < 0)) goto error; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 02:04:55 2024 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 1537479330018776.099062273843; Thu, 20 Sep 2018 14:35:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11D36821CC; Thu, 20 Sep 2018 21:35:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C28EA100034A; Thu, 20 Sep 2018 21:35:27 +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 6B927181A12E; Thu, 20 Sep 2018 21:35:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8KLYjrh004515 for ; Thu, 20 Sep 2018 17:34:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 98DD13091385; Thu, 20 Sep 2018 21:34:45 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-55.phx2.redhat.com [10.3.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54939309137F for ; Thu, 20 Sep 2018 21:34:45 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:34:38 -0400 Message-Id: <20180920213438.6412-4-jferlan@redhat.com> In-Reply-To: <20180920213438.6412-1-jferlan@redhat.com> References: <20180920213438.6412-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] tests: Resolve possible overrun 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 20 Sep 2018 21:35:28 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Coverity noted that each of the fmemopen called used the strlen value in order to allocate space, but that neglected space for terminating null string. So just add 1 to the strlen. Signed-off-by: John Ferlan Reviewed-by: Erik Skultety --- tests/vircgroupmock.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index d512417789..6587fb3c7e 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -466,12 +466,13 @@ FILE *fopen(const char *path, const char *mode) if (STREQ(mode, "r")) { if (allinone) return fmemopen((void *)procmountsallinone, - strlen(procmountsallinone), mode); + strlen(procmountsallinone) + 1, mode); else if (logind) return fmemopen((void *)procmountslogind, - strlen(procmountslogind), mode); + strlen(procmountslogind) + 1, mode); else - return fmemopen((void *)procmounts, strlen(procmounts), mo= de); + return fmemopen((void *)procmounts, + strlen(procmounts) + 1, mode); } else { errno =3D EACCES; return NULL; @@ -481,12 +482,13 @@ FILE *fopen(const char *path, const char *mode) if (STREQ(mode, "r")) { if (allinone) return fmemopen((void *)proccgroupsallinone, - strlen(proccgroupsallinone), mode); + strlen(proccgroupsallinone) + 1, mode); else if (logind) return fmemopen((void *)proccgroupslogind, - strlen(proccgroupslogind), mode); + strlen(proccgroupslogind) + 1, mode); else - return fmemopen((void *)proccgroups, strlen(proccgroups), = mode); + return fmemopen((void *)proccgroups, + strlen(proccgroups) + 1, mode); } else { errno =3D EACCES; return NULL; @@ -496,12 +498,13 @@ FILE *fopen(const char *path, const char *mode) if (STREQ(mode, "r")) { if (allinone) return fmemopen((void *)procselfcgroupsallinone, - strlen(procselfcgroupsallinone), mode); + strlen(procselfcgroupsallinone) + 1, mode); else if (logind) return fmemopen((void *)procselfcgroupslogind, - strlen(procselfcgroupslogind), mode); + strlen(procselfcgroupslogind) + 1, mode); else - return fmemopen((void *)procselfcgroups, strlen(procselfcg= roups), mode); + return fmemopen((void *)procselfcgroups, + strlen(procselfcgroups) + 1, mode); } else { errno =3D EACCES; return NULL; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list