qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: fix bad string passed to error_report()
@ 2016-02-04  9:20 Greg Kurz
  2016-02-04 10:00 ` Amit Shah
  2016-02-04 15:47 ` Eric Blake
  0 siblings, 2 replies; 4+ messages in thread
From: Greg Kurz @ 2016-02-04  9:20 UTC (permalink / raw)
  To: Amit Shah, Juan Quintela; +Cc: qemu-devel

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.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
 migration/savevm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index 954988d12130..3335cc23175c 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'",
+                     state->len, state->name, current_name);
         return -EINVAL;
     }
     return 0;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-04 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-04  9:20 [Qemu-devel] [PATCH] migration: fix bad string passed to error_report() Greg Kurz
2016-02-04 10:00 ` Amit Shah
2016-02-04 10:18   ` Greg Kurz
2016-02-04 15:47 ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).