qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] console: Avoid dereferencing NULL active_consol


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH] console: Avoid dereferencing NULL active_console
Date: Sun, 3 Oct 2010 07:52:00 +0000

Thanks, applied.

On Mon, Sep 20, 2010 at 1:11 PM, Stefan Hajnoczi
<address@hidden> wrote:
> The console_select() function does not check that active_console is
> non-NULL before dereferencing it.  When invoked with qemu -nodefaults it
> is possible to hit this case.
>
> This patch checks that active_console is non-NULL before stashing away
> the old console dimensions in console_select().
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  console.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/console.c b/console.c
> index 698bc10..c1728b1 100644
> --- a/console.c
> +++ b/console.c
> @@ -1060,8 +1060,10 @@ void console_select(unsigned int index)
>
>     if (index >= MAX_CONSOLES)
>         return;
> -    active_console->g_width = ds_get_width(active_console->ds);
> -    active_console->g_height = ds_get_height(active_console->ds);
> +    if (active_console) {
> +        active_console->g_width = ds_get_width(active_console->ds);
> +        active_console->g_height = ds_get_height(active_console->ds);
> +    }
>     s = consoles[index];
>     if (s) {
>         DisplayState *ds = s->ds;
> --
> 1.7.1
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]