[PATCH] network: NULL check for "modify" DNS-txt records

Adam Julis posted 1 patch 3 months, 2 weeks ago
src/conf/network_conf.c | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH] network: NULL check for "modify" DNS-txt records
Posted by Adam Julis 3 months, 2 weeks ago
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>
---
 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;
         }
 
+        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);
 
-- 
2.45.2
Re: [PATCH] network: NULL check for "modify" DNS-txt records
Posted by Michal Prívozník 3 months, 2 weeks ago
On 8/6/24 09:01, Adam Julis wrote:
> 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>
> ---
>  src/conf/network_conf.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal