]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block/vdi: Check for bad signature
authorStefan Weil <sw@weilnetz.de>
Thu, 17 Jan 2013 20:45:28 +0000 (21:45 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 25 Jan 2013 17:18:35 +0000 (18:18 +0100)
vdi_open did not check for a bad signature.
This check was only in vdi_probe.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vdi.c

index 8b768bfa496cee7645f4e8e91944d26e829b3b1b..257a592ea9ef60c213ce08833b576aa625d3d6ec 100644 (file)
@@ -392,7 +392,11 @@ static int vdi_open(BlockDriverState *bs, int flags)
         header.disk_size &= ~(SECTOR_SIZE - 1);
     }
 
-    if (header.version != VDI_VERSION_1_1) {
+    if (header.signature != VDI_SIGNATURE) {
+        logout("bad vdi signature %08x\n", header.signature);
+        ret = -EMEDIUMTYPE;
+        goto fail;
+    } else if (header.version != VDI_VERSION_1_1) {
         logout("unsupported version %u.%u\n",
                header.version >> 16, header.version & 0xffff);
         ret = -ENOTSUP;