提交 4e876bcf 编写于 作者: M Max Reitz 提交者: Kevin Wolf

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: NMax Reitz <mreitz@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 40a99aac
...@@ -1986,6 +1986,10 @@ static int qcow2_change_backing_file(BlockDriverState *bs, ...@@ -1986,6 +1986,10 @@ static int qcow2_change_backing_file(BlockDriverState *bs,
{ {
BDRVQcow2State *s = bs->opaque; 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_file, sizeof(bs->backing_file), backing_file ?: "");
pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: ""); pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: "");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册