diff options
author | Greg Kurz <gkurz@linux.vnet.ibm.com> | 2016-02-05 09:33:26 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:31:48 -0600 |
commit | 73a213544d3e963480bb7017e798d856889bea15 (patch) | |
tree | fea3e315ab8c27661b687abd85a3e8f463291ed3 /migration/savevm.c | |
parent | bd1a02fdc31c17de5ff51227203f1c7a49b66c5b (diff) | |
download | hqemu-73a213544d3e963480bb7017e798d856889bea15.zip hqemu-73a213544d3e963480bb7017e798d856889bea15.tar.gz |
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: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Message-Id: <20160205083201.2201.76109.stgit@bahia.huguette.org>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r-- | migration/savevm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/migration/savevm.c b/migration/savevm.c index 00be5fe..94f2894 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -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; |