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: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] console: Avoid dereferencing NULL active_console
Date: Thu, 30 Sep 2010 18:55:27 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100913 Iceowl/1.0b1 Icedove/3.0.7

Am 20.09.2010 15:11, schrieb Stefan Hajnoczi:
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;


To avoid that still more people fix the same bug,
I'd appreciate shorter commit times for simple patches like this one.

Cheers,
Stefan

Acked-by: Stefan Weil <address@hidden>




reply via email to

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