From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LaGJY-0002yH-7B for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:20:12 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LaGJW-0002xP-3f for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:20:11 -0500 Received: from [199.232.76.173] (port=35029 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaGJU-0002wz-R8 for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:20:08 -0500 Received: from mx2.redhat.com ([66.187.237.31]:38390) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LaGJU-00033E-CL for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:20:08 -0500 From: Eduardo Habkost Date: Thu, 19 Feb 2009 18:19:33 -0300 Message-Id: <1235078376-25559-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1235078376-25559-1-git-send-email-ehabkost@redhat.com> References: <1235078376-25559-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 1/4] vmdk: check for negative sector nums also Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Signed-off-by: Eduardo Habkost --- block-vmdk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block-vmdk.c b/block-vmdk.c index 71d7504..416fb95 100644 --- a/block-vmdk.c +++ b/block-vmdk.c @@ -649,7 +649,7 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, uint64_t cluster_offset; static int cid_update = 0; - if (sector_num > bs->total_sectors) { + if (sector_num < 0 || sector_num > bs->total_sectors) { fprintf(stderr, "(VMDK) Wrong offset: sector_num=0x%" PRIx64 " total_sectors=0x%" PRIx64 "\n", -- 1.6.1