qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] fix gdbserver_state pointer validation


From: stephane duverger
Subject: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation
Date: Mon, 9 Jul 2018 14:54:59 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Hi,

This is a small patch to gdbstub rather insignificant at first sight:
fix null pointer dereference. It actually allows to take benefit of
gdb features (breakpoints/sstep) internally (ie. special purpose
board) without connecting a gdb client to the Qemu instance gdbserver
stub.

Regards,

Signed-off-by: Stephane Duverger <address@hidden>
---
 gdbstub.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdbstub.c b/gdbstub.c
index d6ab95006c..788fd625ab 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1412,6 +1412,9 @@ static int gdb_handle_packet(GDBState *s, const char 
*line_buf)
 
 void gdb_set_stop_cpu(CPUState *cpu)
 {
+    if (!gdbserver_state) {
+        return;
+    }
     gdbserver_state->c_cpu = cpu;
     gdbserver_state->g_cpu = cpu;
 }
-- 
2.14.1




reply via email to

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