]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: driver: Fix off-by-one in qemuDomainSnapshotDiskDataCollect
authorPeter Krempa <pkrempa@redhat.com>
Thu, 20 Jun 2019 13:41:48 +0000 (15:41 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 Jun 2019 14:09:58 +0000 (16:09 +0200)
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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index 40a2aa440fee2ef5f503bccd24062d634c0b3771..ec08dd939edff7ce963d1c65a0d9d97881189963 100644 (file)
@@ -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];