From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16673 invoked by alias); 1 Mar 2011 20:57:36 -0000 Received: (qmail 16664 invoked by uid 22791); 1 Mar 2011 20:57:35 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Mar 2011 20:57:31 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 817AF1A005 for ; Tue, 1 Mar 2011 12:57:30 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost4.vmware.com (Postfix) with ESMTP id 78BDDC9A17 for ; Tue, 1 Mar 2011 12:57:30 -0800 (PST) Message-ID: <4D6D5DBA.90604@vmware.com> Date: Tue, 01 Mar 2011 20:57:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [commit] linespec.c, decode_line_1, check for null. Content-Type: multipart/mixed; boundary="------------030500050605000701050303" 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: 2011-03/txt/msg00044.txt.bz2 This is a multi-part message in MIME format. --------------030500050605000701050303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 98 If it's worth checking for null, it's worth doing so before the first dereference. Checked in. --------------030500050605000701050303 Content-Type: text/plain; name="reversenull4.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="reversenull4.txt" Content-length: 1254 2011-03-01 Michael Snyder * linespec.c (decode_line_1): Check for null before dereference. Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.110 diff -u -p -u -p -r1.110 linespec.c --- linespec.c 1 Mar 2011 00:26:14 -0000 1.110 +++ linespec.c 1 Mar 2011 20:53:54 -0000 @@ -726,7 +726,7 @@ decode_line_1 (char **argptr, int funfir char *copy; /* This says whether or not something in *ARGPTR is quoted with completer_quotes (i.e. with single quotes). */ - int is_quoted; + int is_quoted = 0; /* Is *ARGPTR is enclosed in double quotes? */ int is_quote_enclosed; int is_objc_method = 0; @@ -745,12 +745,15 @@ decode_line_1 (char **argptr, int funfir /* See if arg is *PC. */ - if (**argptr == '*') - return decode_indirect (argptr); + if (*argptr) + { + if (**argptr == '*') + return decode_indirect (argptr); + + is_quoted = (strchr (get_gdb_completer_quote_characters (), + **argptr) != NULL); + } - is_quoted = (*argptr - && strchr (get_gdb_completer_quote_characters (), - **argptr) != NULL); if (is_quoted) end_quote = skip_quoted (*argptr); --------------030500050605000701050303--