qcow2: Fix new L1 table size check (CVE-2014-0143)
authorKevin Wolf <kwolf@redhat.com>
Wed, 26 Mar 2014 12:05:53 +0000 (13:05 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 1 Apr 2014 13:22:35 +0000 (15:22 +0200)
The size in bytes is assigned to an int later, so check that instead of
the number of entries.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/qcow2-cluster.c

index 9499df9ef2d7ef022183ed1f4aa6bc5d38fbaf86..242e1f89b243601cf09f5c3d37f2038400ac088b 100644 (file)
@@ -55,7 +55,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
         }
     }
 
-    if (new_l1_size > INT_MAX) {
+    if (new_l1_size > INT_MAX / sizeof(uint64_t)) {
         return -EFBIG;
     }