qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 9/9] migration: fix bad string passed to error_report


From: Amit Shah
Subject: [Qemu-devel] [PULL 9/9] migration: fix bad string passed to error_report()
Date: Fri, 5 Feb 2016 19:26:54 +0530

From: Greg Kurz <address@hidden>

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 <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Amit Shah <address@hidden>
---
 migration/savevm.c | 4 ++--
 1 file 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;
-- 
2.5.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]