From patchwork Thu Feb 4 09:20:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 578728 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 EE23F140273 for ; Thu, 4 Feb 2016 20:20:48 +1100 (AEDT) Received: from localhost ([::1]:40482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRG5m-0007n2-PC for incoming@patchwork.ozlabs.org; Thu, 04 Feb 2016 04:20:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRG5I-0007OJ-EQ for qemu-devel@nongnu.org; Thu, 04 Feb 2016 04:20:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRG5F-00028e-6Z for qemu-devel@nongnu.org; Thu, 04 Feb 2016 04:20:16 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:35381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRG5E-00028R-T7 for qemu-devel@nongnu.org; Thu, 04 Feb 2016 04:20:13 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Feb 2016 09:20:10 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 4 Feb 2016 09:20:08 -0000 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: gkurz@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id E5ED2219004D for ; Thu, 4 Feb 2016 09:19:54 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u149K8Ve55574646 for ; Thu, 4 Feb 2016 09:20:08 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u149K8XQ003658 for ; Thu, 4 Feb 2016 02:20:08 -0700 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u149K8RA003655; Thu, 4 Feb 2016 02:20:08 -0700 Received: from bahia.huguette.org (sig-9-83-78-101.evts.uk.ibm.com [9.83.78.101]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 98394220302; Thu, 4 Feb 2016 10:20:07 +0100 (CET) From: Greg Kurz To: Amit Shah , Juan Quintela Date: Thu, 04 Feb 2016 10:20:07 +0100 Message-ID: <20160204092007.31588.66396.stgit@bahia.huguette.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16020409-0041-0000-0000-000007282F85 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.106 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] 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 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 Reviewed-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 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;