From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58890 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJupk-0001Xl-8u for qemu-devel@nongnu.org; Wed, 02 Jun 2010 16:46:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJupi-0007yy-4g for qemu-devel@nongnu.org; Wed, 02 Jun 2010 16:46:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43887) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJuph-0007yj-TD for qemu-devel@nongnu.org; Wed, 02 Jun 2010 16:46:38 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o52Kka4p008138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Jun 2010 16:46:36 -0400 Date: Wed, 2 Jun 2010 17:46:31 -0300 From: Luiz Capitulino Message-ID: <20100602174631.2f681a4c@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] block: Fix serial number assignment List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com We should use 'dinfo->serial' length, 'serial' is a pointer, so the serial number length is currently limited to the pointer size. This fixes https://bugs.launchpad.net/qemu/+bug/584143 and is also valid for stable. Signed-off-by: Luiz Capitulino --- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vl.c b/vl.c index 417554f..3de2166 100644 --- a/vl.c +++ b/vl.c @@ -1060,7 +1060,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, dinfo->on_write_error = on_write_error; dinfo->opts = opts; if (serial) - strncpy(dinfo->serial, serial, sizeof(serial)); + strncpy(dinfo->serial, serial, sizeof(dinfo->serial) - 1); QTAILQ_INSERT_TAIL(&drives, dinfo, next); switch(type) { -- 1.7.1.231.gd0b16