]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
network: NULL check for "modify" DNS-txt records
authorAdam Julis <ajulis@redhat.com>
Tue, 6 Aug 2024 07:01:24 +0000 (09:01 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 8 Aug 2024 10:33:40 +0000 (12:33 +0200)
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 <ajulis@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/network_conf.c

index 3af4e1d036f9d34a6f0c9bac22d7d32710ec3c21..c23b0e440064ca6f03ef2d4460b9f3ae13579ccc 100644 (file)
@@ -3385,6 +3385,13 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def,
             goto cleanup;
         }
 
+        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 = g_steal_pointer(&txt.value);