]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: virshAddressParse: check for malformed address
authorJán Tomko <jtomko@redhat.com>
Thu, 10 Dec 2020 08:42:43 +0000 (09:42 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 10 Dec 2020 11:58:54 +0000 (12:58 +0100)
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@redhat.com>
Fixes: 67bf91e1c38b6569357c22b1c83f7b090badba2b
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-domain.c

index befa8d2448c9822abf732c5dd8d2841ea4ec5996..1ef9b8d606f5ac399f2979c59e1517cb95308687 100644 (file)
@@ -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';