From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Kevin Wolf 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> Subject: [Qemu-devel] [PATCH 27/27] block: Fix serial number assignment List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@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) { -- 1.6.6.1