From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUavN-0000WC-RB for qemu-devel@nongnu.org; Fri, 11 Oct 2013 07:30:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUavI-0002KV-S9 for qemu-devel@nongnu.org; Fri, 11 Oct 2013 07:30:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUavI-0002KP-Kv for qemu-devel@nongnu.org; Fri, 11 Oct 2013 07:30:24 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9BBUNd0019348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Oct 2013 07:30:24 -0400 Date: Fri, 11 Oct 2013 19:30:15 +0800 From: Fam Zheng Message-ID: <20131011113015.GA17449@T430s.nay.redhat.com> References: <1381471493-6464-1-git-send-email-famz@redhat.com> <20131011112351.GG3112@dhcp-200-207.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131011112351.GG3112@dhcp-200-207.str.redhat.com> Subject: Re: [Qemu-devel] [PATCH] vmdk: Fix vmdk_parse_extents Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@redhat.com On Fri, 10/11 13:23, Kevin Wolf wrote: > Am 11.10.2013 um 08:04 hat Fam Zheng geschrieben: > > An extra 'p++' after while loop when *p == '\n' will move p to unknown > > data position, risking parsing junk data or memory access violation. > > > > Cc: qemu-stable@nongnu.org > > Signed-off-by: Fam Zheng > > --- > > block/vmdk.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/block/vmdk.c b/block/vmdk.c > > index 5d56e31..f2dda21 100644 > > --- a/block/vmdk.c > > +++ b/block/vmdk.c > > @@ -760,10 +760,13 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, > > } > > next_line: > > /* move to next line */ > > - while (*p && *p != '\n') { > > + while (*p) { > > p++; > > If the first not yet parsed character is \n, you're missing a line break > now, aren't you? > Yes. This case it can miss a whole line following an empty line. Will fix. Thanks. Fam