[libvirt PATCH 1/3] virsh: virshAddressParse: check for malformed address

Ján Tomko jtomko at redhat.com
Thu Dec 10 09:41:08 UTC 2020


The refactor left in the 'if (addr)' check,
but before 'addr' was the return value of strchr
and now it's the return value of virshAddressParse.

Check 'a' instead since that's the return of strchr now.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
Fixes: 67bf91e1c38b6569357c22b1c83f7b090badba2b
---
 tools/virsh-domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index befa8d2448..1ef9b8d606 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -124,7 +124,7 @@ virshAddressParse(const char *str,
     g_autofree char *type = g_strdup(str);
     char *a = strchr(type, ':');
 
-    if (!addr)
+    if (!a)
         return -1;
 
     *a = '\0';
-- 
2.26.2




More information about the libvir-list mailing list