block/dmg: validate chunk size to avoid overflow
commitf6e6652d7c9251236fc1ecc6cece36104c7af15b
authorPeter Wu <peter@lekensteyn.nl>
Tue, 6 Jan 2015 17:48:08 +0000 (6 18:48 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 6 Feb 2015 16:24:21 +0000 (6 17:24 +0100)
tree7d369a8801a35d11b5e3e73a93d92c1354a7bd14
parent7aee37b93a4f694cdd670807f30b8efd33d0c721
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, and whether the resource fork is below the
trailer of the dmg file.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1420566495-13284-6-git-send-email-peter@lekensteyn.nl
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/dmg.c