From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32102 invoked by alias); 14 Sep 2012 11:37:27 -0000 Received: (qmail 32092 invoked by uid 22791); 14 Sep 2012 11:37:26 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Sep 2012 11:37:10 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8EBb95v020790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Sep 2012 07:37:10 -0400 Received: from host2.jankratochvil.net (ovpn-113-58.phx2.redhat.com [10.3.113.58]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8EBb68x010693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 14 Sep 2012 07:37:08 -0400 Date: Fri, 14 Sep 2012 11:37:00 -0000 From: Jan Kratochvil To: Siddhesh Poyarekar Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Replace potentially unsafe alloca with xmalloc/xfree in value_concat Message-ID: <20120914113705.GA20303@host2.jankratochvil.net> References: <20120914144629.67e493d0@spoyarek> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120914144629.67e493d0@spoyarek> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2012-09/txt/msg00278.txt.bz2 Hi Siddhesh, On Fri, 14 Sep 2012 11:16:29 +0200, Siddhesh Poyarekar wrote: > --- gdb/valarith.c 16 Aug 2012 07:36:20 -0000 1.105 > +++ gdb/valarith.c 14 Sep 2012 08:31:38 -0000 > @@ -668,9 +668,11 @@ > if (TYPE_CODE (type2) == TYPE_CODE_STRING > || TYPE_CODE (type2) == TYPE_CODE_CHAR) > { > + struct cleanup *back_to; Empty line after declarations. > count = longest_to_int (value_as_long (inval1)); > inval2len = TYPE_LENGTH (type2); > - ptr = (char *) alloca (count * inval2len); > + ptr = (char *) xmalloc (count * inval2len); > + back_to = make_cleanup (xfree, ptr); OK with that change. Thanks, Jan