diff options
author | Alon Levy <alevy@redhat.com> | 2011-06-20 10:55:45 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-07-06 13:52:20 +0200 |
commit | 7e83957d2244be5469702260b3afe147d3784754 (patch) | |
tree | e91af66fdb8d003e96b2592f1b557a8901cbaab3 /server | |
parent | 6d17dbeb0bf1b57b8290cbd7facccf5beff5ed8f (diff) | |
download | spice-7e83957d2244be5469702260b3afe147d3784754.tar.gz spice-7e83957d2244be5469702260b3afe147d3784754.tar.xz spice-7e83957d2244be5469702260b3afe147d3784754.zip |
server: fix segfault if no migrate_info provided
qemu calls spice_server_migrate_switch even if it didn't do a
spice_server_migrate_info first. Fix the resulting error by not pushing
a switch host tag to the pipe in this case, and add a check anyway in the
marshalling code just in case.
Diffstat (limited to 'server')
-rw-r--r-- | server/reds.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/reds.c b/server/reds.c index eb9c32ac..ca6cf4d7 100644 --- a/server/reds.c +++ b/server/reds.c @@ -3102,12 +3102,23 @@ static void reds_mig_finished(int completed) static void reds_mig_switch(void) { + if (!reds->mig_spice) { + red_printf("warning: reds_mig_switch called without migrate_info set"); + return; + } main_channel_push_migrate_switch(reds->main_channel); } void reds_fill_mig_switch(SpiceMsgMainMigrationSwitchHost *migrate) { RedsMigSpice *s = reds->mig_spice; + + if (s == NULL) { + red_printf( + "error: reds_fill_mig_switch called without migrate info set"); + bzero(migrate, sizeof(*migrate)); + return; + } migrate->port = s->port; migrate->sport = s->sport; migrate->host_size = strlen(s->host) + 1; |