From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5804 invoked by alias); 22 Oct 2005 01:16:35 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 5711 invoked by uid 22791); 22 Oct 2005 01:16:31 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 22 Oct 2005 01:16:31 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j9M1GUo7027309; Fri, 21 Oct 2005 21:16:30 -0400 Received: from devserv.devel.redhat.com (devserv.devel.redhat.com [172.16.58.1]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j9M1GTV11511; Fri, 21 Oct 2005 21:16:29 -0400 Received: from theseus.home..redhat.com (vpn26-11.sfbay.redhat.com [172.16.26.11]) by devserv.devel.redhat.com (8.12.11/8.12.11) with ESMTP id j9M1GSXe025601; Fri, 21 Oct 2005 21:16:29 -0400 To: Andrew STUBBS Cc: gdb-patches@sourceware.org Subject: Re: PATCH: Fix TUI null pointer dereference References: <4353B4A5.3010209@st.com> From: Jim Blandy Date: Sat, 22 Oct 2005 01:16:00 -0000 In-Reply-To: <4353B4A5.3010209@st.com> (Andrew STUBBS's message of "Mon, 17 Oct 2005 15:26:45 +0100") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 X-SW-Source: 2005-10/txt/msg00182.txt.bz2 Andrew STUBBS writes: > 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; How about wrapping the upcasing loop and the 'if' after it all in one big 'if (term), starting right after the 'getenv ("TERM")', and then simplifying the conditional in the upcasing loop?