qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] monitor: check for readline in monitor_event()


From: Luiz Capitulino
Subject: [Qemu-devel] monitor: check for readline in monitor_event()
Date: Mon, 15 Jun 2009 17:38:58 -0300

The call of readline_show_prompt() in CHR_EVENT_RESET's body will
trig a segfault if readline is not being used, because 'mon->rs'
will be NULL.

This fixes the problem by adding the proper check.

I've trigged this while playing with an off-tree code that disables
readline support, I'm not sure whether in-tree code can trig this.

Signed-off-by: Luiz Capitulino <address@hidden>
---
 monitor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index 6b45f6c..787101d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3002,7 +3002,7 @@ static void monitor_event(void *opaque, int event)
     case CHR_EVENT_RESET:
         monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
                        "information\n", QEMU_VERSION);
-        if (mon->chr->focus == 0)
+        if (mon->rs && mon->chr->focus == 0)
             readline_show_prompt(mon->rs);
         break;
     }
-- 
1.6.3.GIT





reply via email to

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