From patchwork Fri Jun 4 16:33:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 54661 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2C7A8B6F11 for ; Sat, 5 Jun 2010 04:24:41 +1000 (EST) Received: from localhost ([127.0.0.1]:34378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKatF-0005no-95 for incoming@patchwork.ozlabs.org; Fri, 04 Jun 2010 13:41:05 -0400 Received: from [140.186.70.92] (port=52842 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKapk-0005ZT-LR for qemu-devel@nongnu.org; Fri, 04 Jun 2010 13:37:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKapd-0002lN-KJ for qemu-devel@nongnu.org; Fri, 04 Jun 2010 13:37:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29016) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKapd-0002l3-AT for qemu-devel@nongnu.org; Fri, 04 Jun 2010 13:37:21 -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 o54HbIVU010162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Jun 2010 13:37:19 -0400 Received: from localhost.localdomain (vpn2-9-144.ams2.redhat.com [10.36.9.144]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o54GXWTA032074; Fri, 4 Jun 2010 12:43:45 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 4 Jun 2010 18:33:15 +0200 Message-Id: <1275669195-28312-28-git-send-email-kwolf@redhat.com> In-Reply-To: <1275669195-28312-1-git-send-email-kwolf@redhat.com> References: <1275669195-28312-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 27/27] block: Fix serial number assignment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Luiz Capitulino 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 Signed-off-by: Kevin Wolf --- blockdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/blockdev.c b/blockdev.c index bd9783a..642ce75 100644 --- a/blockdev.c +++ b/blockdev.c @@ -422,7 +422,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error) 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) {