[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Fix NULL dereference in remoteDomainMigratePrepare2



On Wed, May 12, 2010 at 04:53:13PM +0200, jdenemar redhat com wrote:
> From: Jiri Denemark <jdenemar redhat com>
> 
> ---
>  src/remote/remote_driver.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 990bfce..c62e3d6 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -2849,8 +2849,12 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn,
>          goto done;
>  
>      if (ret.cookie.cookie_len > 0) {
> -        *cookie = ret.cookie.cookie_val; /* Caller frees. */
> -        *cookielen = ret.cookie.cookie_len;
> +        if (cookie && cookielen) {
> +            *cookie = ret.cookie.cookie_val; /* Caller frees. */
> +            *cookielen = ret.cookie.cookie_len;
> +        } else {
> +            VIR_FREE(ret.cookie.cookie_val);
> +        }
>      }

What code would call this with cookie == NULL ?  Any such caller
is a bug I believe.

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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]