From d79ec3f33b91892839c2f7da336d4ea7660ee73a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 20 Jun 2019 15:41:48 +0200 Subject: [PATCH] qemu: driver: Fix off-by-one in qemuDomainSnapshotDiskDataCollect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit f34397e51c17 introduced a crash-inducing problem when collecting disk snapshot data, where the array would be filled starting from the second element. The code then dereferenced the first one. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 40a2aa440f..ec08dd939e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15073,8 +15073,8 @@ qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr driver, if (snapdef->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) continue; - ndata++; dd = data + ndata; + ndata++; dd->disk = vm->def->disks[i]; -- GitLab