From: Andrew STUBBS <andrew.stubbs@st.com>
To: Jim Blandy <jimb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: PATCH: Fix TUI null pointer dereference
Date: Mon, 24 Oct 2005 20:22:00 -0000 [thread overview]
Message-ID: <435D20E0.6040504@st.com> (raw)
In-Reply-To: <vt2pspuzwk3.fsf@theseus.home.>
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
Jim Blandy wrote:
> We generally avoid using assignments directly as conditions. Just
> hoist the assignment out and just say 'if (term)'. With that change,
> feel free to commit.
OK. Here is an updated patch.
I do not have write permission/ability. If I could get that set up that
would be great, but till then somebody else wil have to submit it for me
please.
Thanks
Andrew Stubbs
[-- Attachment #2: tui-NULL-pointer.patch --]
[-- Type: text/plain, Size: 1762 bytes --]
2005-10-24 Andrew Stubbs <andrew.stubbs@st.com>
* tui/tui-command.c (tui_dispatch_ctrl_char): Test output of
getenv() before using it.
Index: src/gdb/tui/tui-command.c
===================================================================
--- src.orig/gdb/tui/tui-command.c 2005-10-24 13:58:38.000000000 +0100
+++ src/gdb/tui/tui-command.c 2005-10-24 18:56:04.000000000 +0100
@@ -68,33 +68,36 @@ tui_dispatch_ctrl_char (unsigned int ch)
** Seems like a bug in the curses library?
*/
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)
{
- unsigned int page_ch = 0;
- unsigned int tmp_char;
-
- tmp_char = 0;
- while (!key_is_end_sequence (tmp_char))
+ for (i = 0; term[i]; i++)
+ term[i] = toupper (term[i]);
+ if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
{
- tmp_char = (int) wgetch (w);
- if (tmp_char == ERR)
- {
- return ch;
- }
- if (!tmp_char)
- break;
- if (tmp_char == 53)
- page_ch = KEY_PPAGE;
- else if (tmp_char == 54)
- page_ch = KEY_NPAGE;
- else
+ unsigned int page_ch = 0;
+ unsigned int tmp_char;
+
+ tmp_char = 0;
+ while (!key_is_end_sequence (tmp_char))
{
- return 0;
+ tmp_char = (int) wgetch (w);
+ if (tmp_char == ERR)
+ {
+ return ch;
+ }
+ if (!tmp_char)
+ break;
+ if (tmp_char == 53)
+ page_ch = KEY_PPAGE;
+ else if (tmp_char == 54)
+ page_ch = KEY_NPAGE;
+ else
+ {
+ return 0;
+ }
}
+ ch_copy = page_ch;
}
- ch_copy = page_ch;
}
switch (ch_copy)
next prev parent reply other threads:[~2005-10-24 18:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-17 14:28 Andrew STUBBS
2005-10-22 1:16 ` Jim Blandy
2005-10-24 13:32 ` Andrew STUBBS
[not found] ` <vt2pspuzwk3.fsf@theseus.home.>
2005-10-24 20:22 ` Andrew STUBBS [this message]
2005-10-31 11:56 ` Daniel Jacobowitz
2005-10-31 16:01 ` Andrew STUBBS
2005-10-31 20:34 ` Andrew STUBBS
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=435D20E0.6040504@st.com \
--to=andrew.stubbs@st.com \
--cc=gdb-patches@sources.redhat.com \
--cc=jimb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox