qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 05/10] block/dmg: validate chunk size to avoid o


From: John Snow
Subject: Re: [Qemu-devel] [PATCH 05/10] block/dmg: validate chunk size to avoid overflow
Date: Fri, 02 Jan 2015 19:02:30 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0



On 12/27/2014 10:01 AM, Peter Wu wrote:
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 <address@hidden>
---
  block/dmg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/dmg.c b/block/dmg.c
index 75e771a..19e4fe2 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;
          }


As mentioned already, please squash your latest changes in your git repository into this patch for v2.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]