diff options
author | Max Reitz <mreitz@redhat.com> | 2016-04-06 18:32:48 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-04-12 18:06:51 +0200 |
commit | 4e876bcf2bdb3a7353df92d19bfec0afd1650bc4 (patch) | |
tree | 3fc1cc0bb4d4d77595d034817d0e48378bcde5e2 /block | |
parent | 40a99aace3f9ffd65af07a89c381db3550b22316 (diff) | |
download | qemu-4e876bcf2bdb3a7353df92d19bfec0afd1650bc4.zip qemu-4e876bcf2bdb3a7353df92d19bfec0afd1650bc4.tar.gz qemu-4e876bcf2bdb3a7353df92d19bfec0afd1650bc4.tar.bz2 |
qcow2: Prevent backing file names longer than 1023
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index 056525c..470734b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -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 ?: ""); |