From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28447 invoked by alias); 1 Nov 2005 16:58:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 28402 invoked by uid 22791); 1 Nov 2005 16:58:17 -0000 Received: from fra-del-01.spheriq.net (HELO fra-del-01.spheriq.net) (195.46.51.97) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 01 Nov 2005 16:58:17 +0000 Received: from fra-out-02.spheriq.net (fra-out-02.spheriq.net [195.46.51.130]) by fra-del-01.spheriq.net with ESMTP id jA1GwDBT005584 for ; Tue, 1 Nov 2005 16:58:13 GMT Received: from fra-cus-01.spheriq.net (fra-cus-01.spheriq.net [195.46.51.37]) by fra-out-02.spheriq.net with ESMTP id jA1GwCp4009755 for ; Tue, 1 Nov 2005 16:58:12 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by fra-cus-01.spheriq.net with ESMTP id jA1GwAmS004542 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Tue, 1 Nov 2005 16:58:11 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 53BAADA41 for ; Tue, 1 Nov 2005 16:58:06 +0000 (GMT) Received: by zeta.dmz-eu.st.com (STMicroelectronics, from userid 60012) id 4480B473DA; Tue, 1 Nov 2005 17:00:58 +0000 (GMT) Received: from zeta.dmz-eu.st.com (localhost [127.0.0.1]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 04B6175969 for ; Tue, 1 Nov 2005 17:00:57 +0000 (UTC) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8AA07473B9 for ; Tue, 1 Nov 2005 17:00:57 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CFE00308 (AUTH "andrew stubbs"); Tue, 1 Nov 2005 16:58:03 GMT Message-ID: <43679E26.4080001@st.com> Date: Tue, 01 Nov 2005 16:58:00 -0000 From: Andrew STUBBS User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [commit] Fix TUI null pointer dereference Content-Type: multipart/mixed; boundary="------------070000000205000802010407" X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.1.07 X-SW-Source: 2005-11/txt/msg00011.txt.bz2 This is a multi-part message in MIME format. --------------070000000205000802010407 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 180 Sorry I have not sent this before. I assumed the [commit] messages were just from people who had not previously posted a [patch]. The committed patch is attached. Andrew Stubbs --------------070000000205000802010407 Content-Type: text/plain; name="tui-NULL-pointer.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tui-NULL-pointer.patch" Content-length: 1762 2005-10-31 Andrew Stubbs * 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) --------------070000000205000802010407--