]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Fix possible segfault when migrating disks
authorMartin Kletzander <mkletzan@redhat.com>
Sun, 13 Dec 2020 14:49:29 +0000 (15:49 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 16 Dec 2020 11:18:58 +0000 (12:18 +0100)
Users can provide URI without a schema.

https://bugzilla.redhat.com/show_bug.cgi?id=1638889

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_migration.c

index fcb33d0364a1fc3a1ea865d3c0e1553ed0b69d29..90b0ec95e35a25bf0b00f245848f1e7fdb0c762e 100644 (file)
@@ -408,6 +408,11 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver,
         if (!uri)
             return -1;
 
+        if (!uri->scheme) {
+            virReportError(VIR_ERR_INVALID_ARG, _("No URI scheme specified: %s"), nbdURI);
+            return -1;
+        }
+
         if (STREQ(uri->scheme, "tcp")) {
             server.transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
             if (!uri->server || STREQ(uri->server, "")) {