https://bugzilla.redhat.com/show_bug.cgi?id=1191355
When we migrate a vm with migrateuri option with a uri do not
have scheme like this:
# virsh migrate test4 --live qemu+ssh://lhuang/system --migrateuri 127.0.0.1
target libvirtd will crashed because uri->scheme is NULL in
qemuMigrationPrepareDirect this line:
if (STRNEQ(uri->scheme, "tcp") &&
add a value check before this line.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/qemu/qemu_migration.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 879b1bf..5c3b73e 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3281,6 +3281,13 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
if (!(uri = qemuMigrationParseURI(uri_in, &well_formed_uri)))
goto cleanup;
+ if (uri->scheme == NULL) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("missing scheme in migration URI: %s"),
+ uri_in);
+ goto cleanup;
+ }
+
if (STRNEQ(uri->scheme, "tcp") &&
STRNEQ(uri->scheme, "rdma")) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
--
1.8.3.1