Skip to content
Snippets Groups Projects
Commit 15d61692 authored by Greg Kurz's avatar Greg Kurz Committed by Amit Shah
Browse files

migration: fix bad string passed to error_report()


state->name does not contain a terminating '\0' and you may get:

Machine type received is 'pseries-2.3y�?' and local is 'pseries-2.4'
load of migration failed: Invalid argument

Let's add a precision modifier to fix this.

Reviewed-by: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarGreg Kurz <gkurz@linux.vnet.ibm.com>
Message-Id: <20160205083201.2201.76109.stgit@bahia.huguette.org>
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
parent 1483e0d7
No related branches found
No related tags found
No related merge requests found
......@@ -299,8 +299,8 @@ static int configuration_post_load(void *opaque, int version_id)
const char *current_name = MACHINE_GET_CLASS(current_machine)->name;
if (strncmp(state->name, current_name, state->len) != 0) {
error_report("Machine type received is '%s' and local is '%s'",
state->name, current_name);
error_report("Machine type received is '%.*s' and local is '%s'",
(int) state->len, state->name, current_name);
return -EINVAL;
}
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment