[virt-tools-list] [PATCH] Avoid 'Dereference of a null pointer'

Pavel Grunt pgrunt at redhat.com
Wed Mar 11 10:01:36 UTC 2015


Hi, ack

Although I don't think we can currently reach the situation where username is NULL

----- Original Message -----
> 
> Caught by Covscan.
> ---
>  src/virt-viewer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index ec7d875..e4bca74 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -812,7 +812,7 @@
> virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
>          VirtViewerWindow *vwin =
>          virt_viewer_app_get_main_window(VIRT_VIEWER_APP(app));
>          GtkWindow *win = virt_viewer_window_get_window(vwin);
>  
> -        if (*username == NULL || **username == '\0')
> +        if (username && (*username == NULL || **username == '\0'))
>              *username = g_strdup(g_get_user_name());
>  
>          priv->auth_cancelled =
>          !virt_viewer_auth_collect_credentials(win,
> --
> 2.3.1
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
> 




More information about the virt-tools-list mailing list