From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] vmdk: Fix vmdk_parse_extents
Date: Mon, 14 Oct 2013 09:57:08 +0800 [thread overview]
Message-ID: <20131014015708.GA9183@T430s.nay.redhat.com> (raw)
In-Reply-To: <1381492109-24999-1-git-send-email-famz@redhat.com>
Cc'ing qemu-stable@nongnu.org.
On Fri, 10/11 19:48, Fam Zheng wrote:
> 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 <famz@redhat.com>
> ---
> block/vmdk.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 5d56e31..21f0fa7 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) {
> + if (*p == '\n') {
> + p++;
> + break;
> + }
> p++;
> }
> - p++;
> }
> return 0;
> }
> --
> 1.8.3.1
>
>
prev parent reply other threads:[~2013-10-14 1:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 11:48 [Qemu-devel] [PATCH v2] vmdk: Fix vmdk_parse_extents Fam Zheng
2013-10-11 11:55 ` Kevin Wolf
2013-10-14 1:57 ` Fam Zheng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131014015708.GA9183@T430s.nay.redhat.com \
--to=famz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).