]> xenbits.xensource.com Git - qemu-upstream-4.2-testing.git/commit
qcow2: Fix NULL dereference in qcow2_open() error path (CVE-2014-0146)
authorKevin Wolf <kwolf@redhat.com>
Thu, 5 Mar 2015 10:41:34 +0000 (10:41 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 5 Mar 2015 13:22:12 +0000 (13:22 +0000)
commitdf2adab2575fa19764b744edafea1a202f904912
treeb84ff104148f3688f9dfe26914fca83b22b926c4
parente962bea4db167113d1bd4e640888c261763f9dd1
qcow2: Fix NULL dereference in qcow2_open() error path (CVE-2014-0146)

The qcow2 code assumes that s->snapshots is non-NULL if s->nb_snapshots
!= 0. By having the initialisation of both fields separated in
qcow2_open(), any error occuring in between would cause the error path
to dereference NULL in qcow2_free_snapshots() if the image had any
snapshots.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
block/qcow2.c