From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26151 invoked by alias); 19 Mar 2008 19:13:51 -0000 Received: (qmail 26143 invoked by uid 22791); 19 Mar 2008 19:13:50 -0000 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO nimbus.ott.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 19 Mar 2008 19:13:28 +0000 Received: by nimbus.ott.qnx.com with Internet Mail Service (5.5.2653.19) id ; Wed, 19 Mar 2008 15:13:26 -0400 Message-ID: <47E165D3.7090203@qnx.com> From: Aleksandar Ristovski To: gdb-patches@sourceware.org Subject: [patch] Avoid null ptr dereference in maint cplus first_component Date: Wed, 19 Mar 2008 19:13:00 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) user-agent: Thunderbird 2.0.0.12 (Windows/20080213) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C889F5.4D375FC6" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-03/txt/msg00287.txt.bz2 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C889F5.4D375FC6 Content-Type: text/plain; charset="iso-8859-1" Content-length: 306 Hello, A trivial patch to avoid segemtation fault when no argument is supplied to 'maint cplus first_component' command. Thanks, --- Aleksandar Ristovski QNX Software Systems 2008-03-19 Aleksandar Ristovski * cp-support.c (first_component_command): Return if no arguments. ------_=_NextPart_000_01C889F5.4D375FC6 Content-Type: text/plain; name="cp-support.c.diff" Content-Disposition: attachment; filename="cp-support.c.diff" Content-length: 686 Index: gdb/cp-support.c =================================================================== RCS file: /cvs/src/src/gdb/cp-support.c,v retrieving revision 1.26 diff -u -p -r1.26 cp-support.c --- gdb/cp-support.c 1 Jan 2008 22:53:09 -0000 1.26 +++ gdb/cp-support.c 19 Mar 2008 19:07:54 -0000 @@ -892,8 +892,14 @@ maint_cplus_command (char *arg, int from static void first_component_command (char *arg, int from_tty) { - int len = cp_find_first_component (arg); - char *prefix = alloca (len + 1); + int len; + char *prefix; + + if (!arg) + return; + + len = cp_find_first_component (arg); + prefix = alloca (len + 1); memcpy (prefix, arg, len); prefix[len] = '\0'; ------_=_NextPart_000_01C889F5.4D375FC6--