]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_nbdkit: fix possible null dereference
authorPavel Hrdina <phrdina@redhat.com>
Wed, 20 Sep 2023 11:45:59 +0000 (13:45 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 20 Sep 2023 12:25:17 +0000 (14:25 +0200)
Function virGetConnectSecret() can return NULL so we need to check it
since in virSecretGetSecretString() it gets dereferenced.

Reported-by: coverity
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_nbdkit.c

index 66b09cd240c6307830adad44be0452fde1486451..17819ca992a14b4b0dce4cb712e605e697050d0d 100644 (file)
@@ -971,6 +971,9 @@ qemuNbdkitProcessBuildCommandAuth(virStorageAuthDef *authdef,
     }
 
     conn = virGetConnectSecret();
+    if (!conn)
+        return -1;
+
     if (virSecretGetSecretString(conn,
                                  &authdef->seclookupdef,
                                  secrettype,