[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH for-2.0 35/47] dmg: use appropriate types when read
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-stable] [PATCH for-2.0 35/47] dmg: use appropriate types when reading chunks |
Date: |
Wed, 26 Mar 2014 13:05:57 +0100 |
Use the right types instead of signed int:
size_t new_size;
This is a byte count for g_realloc() that is calculated from uint32_t
and size_t values.
uint32_t chunk_count;
Use the same type as s->n_chunks, which is used together with
chunk_count.
This patch is a cleanup and does not fix bugs.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/dmg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/dmg.c b/block/dmg.c
index 1cc5426..f98c94d 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -161,7 +161,8 @@ static int dmg_open(BlockDriverState *bs, QDict *options,
int flags,
}
if (type == 0x6d697368 && count >= 244) {
- int new_size, chunk_count;
+ size_t new_size;
+ uint32_t chunk_count;
offset += 4;
offset += 200;
--
1.8.5.3
- [Qemu-stable] [PATCH for-2.0 39/47] block: vdi bounds check qemu-io tests, (continued)
- [Qemu-stable] [PATCH for-2.0 36/47] dmg: sanitize chunk length and sectorcount (CVE-2014-0145), Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 32/47] dmg: coding style and indentation cleanup, Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 29/47] qcow2: Fix types in qcow2_alloc_clusters and alloc_clusters_noref, Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 35/47] dmg: use appropriate types when reading chunks,
Stefan Hajnoczi <=
- [Qemu-stable] [PATCH for-2.0 34/47] dmg: drop broken bdrv_pread() loop, Stefan Hajnoczi, 2014/03/26
- [Qemu-stable] [PATCH for-2.0 33/47] dmg: prevent out-of-bounds array access on terminator, Stefan Hajnoczi, 2014/03/26