From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26429 invoked by alias); 4 Apr 2006 10:27:05 -0000 Received: (qmail 26420 invoked by uid 22791); 4 Apr 2006 10:27:05 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-03.spheriq.net (HELO lon-del-03.spheriq.net) (195.46.50.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 04 Apr 2006 10:27:03 +0000 Received: from lon-out-01.spheriq.net ([195.46.50.129]) by lon-del-03.spheriq.net with ESMTP id k34AQxGk022256 for ; Tue, 4 Apr 2006 10:26:59 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-01.spheriq.net with ESMTP id k34AQvw9001820 for ; Tue, 4 Apr 2006 10:26:57 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id k34AQroi023123 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Tue, 4 Apr 2006 10:26:57 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A862FDA44 for ; Tue, 4 Apr 2006 10:26:53 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AEFA64727B for ; Tue, 4 Apr 2006 10:30:56 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CHK56740 (AUTH stubbsa); Tue, 4 Apr 2006 11:26:50 +0100 (BST) Message-ID: <44324959.4@st.com> Date: Tue, 04 Apr 2006 10:27:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: GDB Patches Subject: [PATCH] allow nested sourced commands References: <442BD6F1.8070804@st.com> In-Reply-To: <442BD6F1.8070804@st.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.2.01 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00026.txt.bz2 Andrew Stubbs wrote: > I have discovered a problem in the GDB command line reading code. > > command_line_input() uses a static buffer to hold the current command. > This means that it is not properly re-entrant - commands that contain > other commands, such as user defined commands, are not handled safely. See http://sources.redhat.com/ml/gdb-patches/2006-03/msg00356.html The attached patch should fix the problem. I tried to fix the problem in command_line_input, but there were too many ways for the string to leak, so I have opted for the simpler fix, even though it feels like treating the symptoms, not the problem. Anyway, with this patch it no longer attempts to read data that has been overwritten, so everything works fine. Valgrind reports no problems with the test case I posted before. Andrew Stubbs