From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27550 invoked by alias); 24 Oct 2008 18:43:46 -0000 Received: (qmail 27541 invoked by uid 22791); 24 Oct 2008 18:43:45 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Oct 2008 18:43:06 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 8960A10812; Fri, 24 Oct 2008 18:43:03 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 64A30106D8; Fri, 24 Oct 2008 18:43:03 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1KtRcj-00026D-BZ; Fri, 24 Oct 2008 14:43:01 -0400 Date: Fri, 24 Oct 2008 18:43:00 -0000 From: Daniel Jacobowitz To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [commit] dwarf2read.c (typename_concat): avoid segv Message-ID: <20081024184301.GA7759@caradoc.them.org> Mail-Followup-To: Doug Evans , gdb-patches@sourceware.org References: <20081024182614.58B191C7947@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081024182614.58B191C7947@localhost> User-Agent: Mutt/1.5.17 (2008-05-11) 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-10/txt/msg00611.txt.bz2 On Fri, Oct 24, 2008 at 11:26:14AM -0700, Doug Evans wrote: > Hi. I checked in the following as obvious. > Running a large app with many shared libs under gdb -r caused gdb to segv. Shouldn't this be in the affected caller? I thought we wouldn't reach here if prefix or suffix are NULL. > if (obs == NULL) > { > char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1); > - retval[0] = '\0'; > - > - if (prefix) > - { > - strcpy (retval, prefix); > - strcat (retval, sep); > - } > - if (suffix) > - strcat (retval, suffix); > - > + strcpy (retval, prefix); > + strcat (retval, sep); > + strcat (retval, suffix); > return retval; > } > else If NULL values are valid, this change is definitely not correct. You've changed a NULL prefix and "foo" suffix from "foo" to "::foo". -- Daniel Jacobowitz CodeSourcery