From patchwork Fri Feb 5 13:56:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 579489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C4C961402ED for ; Sat, 6 Feb 2016 01:01:20 +1100 (AEDT) Received: from localhost ([::1]:48483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgwo-0007sL-R4 for incoming@patchwork.ozlabs.org; Fri, 05 Feb 2016 09:01:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgt7-0001gr-8v for qemu-devel@nongnu.org; Fri, 05 Feb 2016 08:57:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRgt6-00032e-DS for qemu-devel@nongnu.org; Fri, 05 Feb 2016 08:57:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgt6-00032C-85 for qemu-devel@nongnu.org; Fri, 05 Feb 2016 08:57:28 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id B96A87AEB5; Fri, 5 Feb 2016 13:57:27 +0000 (UTC) Received: from localhost (dhcp193-102.pnq.redhat.com [10.65.193.102]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u15DvQlu003996; Fri, 5 Feb 2016 08:57:26 -0500 From: Amit Shah To: Peter Maydell Date: Fri, 5 Feb 2016 19:26:54 +0530 Message-Id: <15d61692da651fc79b3fc40050b986c5a73055c0.1454680535.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu list , Amit Shah , Greg Kurz , "Dr. David Alan Gilbert" , Juan Quintela Subject: [Qemu-devel] [PULL 9/9] migration: fix bad string passed to error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Greg Kurz 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 Signed-off-by: Greg Kurz Message-Id: <20160205083201.2201.76109.stgit@bahia.huguette.org> Signed-off-by: Amit Shah --- 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;