]> xenbits.xensource.com Git - qemu-upstream-4.3-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:42:00 +0000 (10:42 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 5 Mar 2015 13:21:57 +0000 (13:21 +0000)
commit8c58457e2e407d3b674bbf0df61f75f6fcad4aee
treee6abe8b1632e8a950fa119d3bd4d594ca3cac596
parent9af4ce8dc021c44a5f0a7247c9ea17ecf1164cf6
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