From nobody Sun Nov 24 06:22:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172292771742187.4983652145271; Tue, 6 Aug 2024 00:01:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 19DF2C58; Tue, 6 Aug 2024 03:01:56 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B8EBDC5C; Tue, 6 Aug 2024 03:01:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6D959B03; Tue, 6 Aug 2024 03:01:34 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 022D9C07 for ; Tue, 6 Aug 2024 03:01:33 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-8P1YPjFOM0Gv_wVdzjCG1A-1; Tue, 06 Aug 2024 03:01:32 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D4861955D45 for ; Tue, 6 Aug 2024 07:01:31 +0000 (UTC) Received: from ajulis-thinkpadt14gen4.remote.csb (unknown [10.43.2.246]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4972C19560AA for ; Tue, 6 Aug 2024 07:01:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722927693; h=from:from: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; bh=pomrqX2sOQYi1vJFwV3DJ60mgh2xa2r++tS3seB2yNM=; b=C/6J8JoKK78VvBjsyuA5BGRVNJ1amoUlpw1Wl47lKwuKsrKDr0uVC+IRT30DxYyZKcYD/9 uiEuqUe18tHnRMGctUTeZz8A7PPk7t3rhUhdEKttCNiGTCnvwRLFLgX9A1ViYTi/WJsSLB 8tIvPCvfDUbh/ecc4ccl+6vC5m7a59k= X-MC-Unique: 8P1YPjFOM0Gv_wVdzjCG1A-1 From: Adam Julis To: devel@lists.libvirt.org Subject: [PATCH] network: NULL check for "modify" DNS-txt records Date: Tue, 6 Aug 2024 09:01:24 +0200 Message-ID: <97401a22ca624b959111e6af531d80b1aec7436b.1722927613.git.ajulis@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: C3BRDTGEKNZCDTTHUG2BWTZX27E62ADW X-Message-ID-Hash: C3BRDTGEKNZCDTTHUG2BWTZX27E62ADW X-MailFrom: ajulis@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1722927718888116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The "modify" command allowed to replace an existing record, now checks for the NULL string in the new value and throw error if found. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/655 Signed-off-by: Adam Julis Reviewed-by: Michal Privoznik --- src/conf/network_conf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 3af4e1d036..c23b0e4400 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -3385,6 +3385,13 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def, goto cleanup; } =20 + if (!txt.value) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("missing value of modifying DNS TXT record in= network %1$s"), + def->name); + goto cleanup; + } + VIR_FREE(dns->txts[foundIdx].value); dns->txts[foundIdx].value =3D g_steal_pointer(&txt.value); =20 --=20 2.45.2