This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PATCH: Fix TUI null pointer dereference
- From: Andrew STUBBS <andrew dot stubbs at st dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 17 Oct 2005 15:26:45 +0100
- Subject: PATCH: Fix TUI null pointer dereference
Hi,
The attached patch fixes a NULL pointer dereference starting the TUI
when the TERM environment variable is not set. This is a particular
problem on windows where that variable is not usually set.
2005-10-17 Andrew Stubbs <andrew.stubbs@st.com>
* tui/tui-command.c (tui_dispatch_ctrl_char): Test output of
getenv() before using it.
Andrew Stubbs
Index: src/gdb/tui/tui-command.c
===================================================================
--- src.orig/gdb/tui/tui-command.c 2004-02-16 21:05:09.000000000 +0000
+++ src/gdb/tui/tui-command.c 2005-10-17 14:33:06.000000000 +0100
@@ -70,7 +70,7 @@ tui_dispatch_ctrl_char (unsigned int ch)
term = (char *) getenv ("TERM");
for (i = 0; (term && term[i]); i++)
term[i] = toupper (term[i]);
- if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
+ if (term && (strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
{
unsigned int page_ch = 0;
unsigned int tmp_char;