qemu-img: Fix segfault during rebase

This fixes a possible read beyond the end of the temporary buffers used for
comparing data in the old and the new backing file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
master
Kevin Wolf 2010-02-17 12:32:59 +01:00 committed by Anthony Liguori
parent 4805bb6696
commit 60b1bd4fc5
1 changed files with 1 additions and 1 deletions

View File

@ -1224,7 +1224,7 @@ static int img_rebase(int argc, char **argv)
int pnum;
if (compare_sectors(buf_old + written * 512,
buf_new + written * 512, n, &pnum))
buf_new + written * 512, n - written, &pnum))
{
ret = bdrv_write(bs, sector + written,
buf_old + written * 512, pnum);