summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block/dmg.c2
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;
}