From: Peter Krempa Date: Thu, 20 Jun 2019 13:41:48 +0000 (+0200) Subject: qemu: driver: Fix off-by-one in qemuDomainSnapshotDiskDataCollect X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d79ec3f33b91892839c2f7da336d4ea7660ee73a;p=libvirt.git qemu: driver: Fix off-by-one in qemuDomainSnapshotDiskDataCollect 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 --- 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];