[PATCH] cmdDomBlkError: Fix crash when initial call to virDomainGetDiskErrors fails

Pavel Hrdina phrdina at redhat.com
Mon Apr 19 08:27:26 UTC 2021


On Mon, Apr 19, 2021 at 08:25:00AM +0200, Peter Krempa wrote:
> virDomainGetDiskErrors uses the weird semantics where we make the
> caller query for the number of elements and then pass pre-allocated
> structure.
> 
> The cleanup section errorneously used the 'count' variable to free the
> allocated elements for the API but 'count' can be '-1' in cases when the
> API returns failure, thus attempting to free beyond the end of the
> array.
> 
> Resolves: https://gitlab.com/libvirt/libvirt/-/issues/155
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  tools/virsh-domain-monitor.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210419/940be90f/attachment-0001.sig>


More information about the libvir-list mailing list