diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-12-26 13:16:48 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-12-27 15:47:23 +0100 |
commit | 6ff6f33bd0cb23d4c00255c1e58b72a3a2d29fbe (patch) | |
tree | c34dacb79b4465a17f345c00200dbc68d744f6fc | |
parent | 6d14a8bdbb7de112bc79b4938c9c8ffc5409a739 (diff) | |
download | qemu-6ff6f33bd0cb23d4c00255c1e58b72a3a2d29fbe.tar.gz |
block/dmg: validate chunk size to avoid overflow
Previously the chunk size was not checked, allowing for a large memory
allocation. This patch checks whether the chunks size is within the
resource fork length.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r-- | block/dmg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/dmg.c b/block/dmg.c index 75e771af40..19e4fe2b19 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -308,7 +308,7 @@ static int dmg_read_resource_fork(BlockDriverState *bs, DmgHeaderState *ds, ret = read_uint32(bs, offset, &count); if (ret < 0) { goto fail; - } else if (count == 0) { + } else if (count == 0 || count > info_end - offset) { ret = -EINVAL; goto fail; } |