[libvirt] [PATCH] xenapi: Check for NULL before accessing the scheme

Daniel P. Berrange berrange at redhat.com
Mon Mar 15 15:28:28 UTC 2010


On Sun, Mar 14, 2010 at 10:09:01PM +0100, Matthias Bolte wrote:
> ---
>  src/xenapi/xenapi_driver.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
> index 00b62b3..9a38e3f 100644
> --- a/src/xenapi/xenapi_driver.c
> +++ b/src/xenapi/xenapi_driver.c
> @@ -87,7 +87,8 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUS
>      char *password = NULL;
>      struct _xenapiPrivate *privP = NULL;
>  
> -    if (STRCASENEQ(conn->uri->scheme, "XenAPI")) {
> +    if (conn->uri == NULL || conn->uri->scheme == NULL ||
> +        STRCASENEQ(conn->uri->scheme, "XenAPI")) {
>          return VIR_DRV_OPEN_DECLINED;
>      }
>  

ACK

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list