From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8689 invoked by alias); 10 Feb 2004 05:44:12 -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 8669 invoked from network); 10 Feb 2004 05:44:10 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by sources.redhat.com with SMTP; 10 Feb 2004 05:44:10 -0000 Received: from [207.232.27.5] (helo=WST0054) by monty-python.gnu.org with asmtp (Exim 4.24) id 1AqQdY-0007MO-S1; Tue, 10 Feb 2004 00:40:45 -0500 Date: Tue, 10 Feb 2004 05:44:00 -0000 Message-Id: From: Eli Zaretskii To: Daniel Jacobowitz CC: carlton@kealia.com,gdb-patches@sources.redhat.com In-reply-to: <20040209211010.GA25073@nevyn.them.org> (message from Daniel Jacobowitz on Mon, 9 Feb 2004 16:10:10 -0500) Subject: Re: Avoid obstack_free in cp-namespace.c Reply-to: Eli Zaretskii References: <20040209211010.GA25073@nevyn.them.org> X-SW-Source: 2004-02/txt/msg00227.txt.bz2 > Date: Mon, 9 Feb 2004 16:10:10 -0500 > From: Daniel Jacobowitz > > - char *name_copy = obsavestring (name, len, &objfile->objfile_obstack); > - struct symbol *sym = lookup_block_symbol (block, name_copy, NULL, > - VAR_DOMAIN); > + char *name_copy = alloca (len + 1); > + struct symbol *sym; > + > + memcpy (name_copy, name, len); > + name_copy[len] = '\0'; How large can the value of `len' be? I believe we have some coding guidelines against using alloca for allocations that are too large.