From nobody Mon Feb 9 01:17:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614696619; cv=none; d=zohomail.com; s=zohoarc; b=hQlO3q39uOzVvynOCbEdhLzVA3On8fScmj6ld4ZdJbEiFVvg8hZcncEkuutPMMdyUl4AC7TTrI9AiXcLX3SK4X9dkl0s8ig32912zWomMWAbnoHFhUMtaWOATtweXASKI7XmY/a+Q1C+uupMxeCTVZfvnpdJ3OkrbCcsVnE5trM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614696619; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CpDgj/HcG3+6LVdbnL4UKWH8kuiuxY5DTG5bSZ4Bdu8=; b=grTfO0ZO+sdwDem33YaawbufBrU82wCo06WPJI5ZD+u8XAETmvAySzgMjV2UIZIpsL2gn6LxKkSHKjupCLpLxMN2Ne6Qrzrw47sQ/GL4yP91U+qb7y3CZTlP4zCIGFw5EQjQs0IaRkcEVzsNZqzUFGPnRnTn6AaARmmxu+3neYs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614696619275947.7813712520093; Tue, 2 Mar 2021 06:50:19 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-I71v4CYzPGaHkRrlHVaqqA-1; Tue, 02 Mar 2021 09:50:16 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D32D7107ACE8; Tue, 2 Mar 2021 14:50:08 +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 A8A091002388; Tue, 2 Mar 2021 14:50:08 +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 657065807D; Tue, 2 Mar 2021 14:50:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 122EnoD0014526 for ; Tue, 2 Mar 2021 09:49:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7793D5D722; Tue, 2 Mar 2021 14:49:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id D162C5D766 for ; Tue, 2 Mar 2021 14:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614696618; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CpDgj/HcG3+6LVdbnL4UKWH8kuiuxY5DTG5bSZ4Bdu8=; b=QHSk7yYkoPbBo+XB4hUsDveBZjqoXS04rUbW51WKp4tAWos/dqHBf4egyMWAfcwaiUutQc JW6X3PwPiWstnMXogvj/NybYgnPcfoa2hV5oNSf7SrZV39zJLB8JHKyZCYClSodP1G8B6L sTrpPoXp9SwjISZJQdjcuiA2l2Vio4U= X-MC-Unique: I71v4CYzPGaHkRrlHVaqqA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/16] xenParseXLChannel: Use g_strndup instead of virStrndup Date: Tue, 2 Mar 2021 15:49:28 +0100 Message-Id: <9b3d8f4d8e1dcff0fba333c0c24721e88eb73323.1614696480.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Make the temporary string a autofree-ing pointer and copy the contents. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libxl/xen_xl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 4113be8cd1..9b2a2fe292 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1070,7 +1070,7 @@ xenParseXLChannel(virConfPtr conf, virDomainDefPtr de= f) if (list && list->type =3D=3D VIR_CONF_LIST) { list =3D list->list; while (list) { - char type[10]; + g_autofree char *type =3D NULL; char *key; if ((list->type !=3D VIR_CONF_STRING) || (list->str =3D=3D NUL= L)) @@ -1087,11 +1087,8 @@ xenParseXLChannel(virConfPtr conf, virDomainDefPtr d= ef) if (STRPREFIX(key, "connection=3D")) { int len =3D nextkey ? (nextkey - data) : strlen(data); - if (virStrncpy(type, data, len, sizeof(type)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("connection %s too big"), data); - goto skipchannel; - } + g_clear_pointer(&type, g_free); + type =3D g_strndup(data, len); } else if (STRPREFIX(key, "name=3D")) { int len =3D nextkey ? (nextkey - data) : strlen(data); VIR_FREE(name); --=20 2.29.2