diff options
author | Fam Zheng <famz@redhat.com> | 2013-12-09 13:24:36 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-12-20 09:11:58 +0100 |
commit | b47053bd0359c68094d7a25a65687c0844771e34 (patch) | |
tree | b4b68fcddcfdd1fea931c5044c85436c958467eb /block/vmdk.c | |
parent | 8282db1b2e7394574cb55fcc608c5cb0df159d8f (diff) | |
download | qemu-b47053bd0359c68094d7a25a65687c0844771e34.zip |
vmdk: Check VMFS extent line field number
VMFS extent line in description file should be with 4 fields:
RW <size> VMFS "file-name.vmdk"
Check the number explicitly and report error if offset is appended as
FLAT, which should be invalid format.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r-- | block/vmdk.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/block/vmdk.c b/block/vmdk.c index 0734bc200c..7917ad0c06 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -749,9 +749,14 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, return -EINVAL; } } else if (!strcmp(type, "VMFS")) { - flat_offset = 0; + if (ret == 4) { + flat_offset = 0; + } else { + error_setg(errp, "Invalid extent lines:\n%s", p); + return -EINVAL; + } } else if (ret != 4) { - error_setg(errp, "Invalid extent lines: \n%s", p); + error_setg(errp, "Invalid extent lines:\n%s", p); return -EINVAL; } |