[Libvirt-cim] [PATCH 2 of 2] Fix seg fault in Virt_DevicePool - verify to be sure list is not NULL

Richard Maciel rmaciel at linux.vnet.ibm.com
Fri Oct 30 15:58:34 UTC 2009


On 10/28/2009 06:01 PM, Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert<karupert at us.ibm.com>
> # Date 1256771106 25200
> # Node ID 68c625f1d36545bc3de39ae0c1402914d8dc2b58
> # Parent  4eed878f31e95806a9cd345f656b7382945b8985
> Fix seg fault in Virt_DevicePool - verify to be sure list is not NULL
>
> This can happen if _get_pools() is unable to connect to libvirt.
>
> diff -r 4eed878f31e9 -r 68c625f1d365 src/Virt_DevicePool.c
> --- a/src/Virt_DevicePool.c	Mon Oct 26 07:47:48 2009 -0700
> +++ b/src/Virt_DevicePool.c	Wed Oct 28 16:05:06 2009 -0700
> @@ -1210,6 +1210,14 @@
>           if (s.rc != CMPI_RC_OK)
>                   goto out;
>
> +        if (list.cur<= 0) {

This is probably nitpicking, but the cur member is an unsigned int, so 
its value won't ever be less than 0. :-P

> +                cu_statusf(broker,&s,
> +                           CMPI_RC_ERR_NOT_FOUND,
> +                           "No such instance (%s)",
> +                           id);
> +                goto out;
> +        }
> +
>           *_inst = list.list[0];
>
>    out:
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim


-- 
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list