]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qcow2: Prevent backing file names longer than 1023
authorMax Reitz <mreitz@redhat.com>
Wed, 6 Apr 2016 16:32:48 +0000 (18:32 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 12 Apr 2016 16:06:51 +0000 (18:06 +0200)
We reject backing file names with a length of more than 1023 characters
when opening a qcow2 file, so we should not produce such files
ourselves.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2.c

index 056525c7fd2bd2cc223215ddd33ecc73423d2f99..470734be9ff17016778a219d20c6c05deb3d035a 100644 (file)
@@ -1986,6 +1986,10 @@ static int qcow2_change_backing_file(BlockDriverState *bs,
 {
     BDRVQcow2State *s = bs->opaque;
 
+    if (backing_file && strlen(backing_file) > 1023) {
+        return -EINVAL;
+    }
+
     pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: "");
     pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: "");