From 5db1fc56022642e610c911efd28f3a931279e917 Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Sun, 13 Dec 2020 15:49:29 +0100 Subject: [PATCH] qemu: Fix possible segfault when migrating disks Users can provide URI without a schema. https://bugzilla.redhat.com/show_bug.cgi?id=1638889 Signed-off-by: Martin Kletzander --- src/qemu/qemu_migration.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index fcb33d0364..90b0ec95e3 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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, "")) { -- 2.47.3