]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virLockSpaceNewPostExecRestart: Fix out-of-bounds array access
authorPeter Krempa <pkrempa@redhat.com>
Fri, 12 Mar 2021 09:16:11 +0000 (10:16 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 12 Mar 2021 10:02:35 +0000 (11:02 +0100)
commiteab7ae6bfe13503ea705e70e32edaa60357cbaa1
tree33989ecb6dd6e3841bc0fbd1e445950aca964670
parent6b8e961399549c5c8fdf06875e5981c564829ad6
virLockSpaceNewPostExecRestart: Fix out-of-bounds array access

'res->owners' is allocated to 'res->nOwners' elements, but unfortunately
'res->nOwners' doesn't contain the proper value until after the
allocation so 0 elements are allocated. The following loop which assumes
that the array has the right number of elements then accesses the
pointer out of bounds. The bug was also faithfully converted from
VIR_ALLOC_N to g_new0.

Fixes: 4a3d6ed5ee0
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virlockspace.c