From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10342 invoked by alias); 7 Jun 2002 20:12:48 -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 10324 invoked from network); 7 Jun 2002 20:12:45 -0000 Received: from unknown (HELO potter.sfbay.redhat.com) (205.180.83.107) by sources.redhat.com with SMTP; 7 Jun 2002 20:12:45 -0000 Received: from localhost.localdomain (IDENT:yh+6jEBOaOF76YT/WiErcE0hXiwtRK5p@romulus.sfbay.redhat.com [172.16.27.251]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g57KAPv16836 for ; Fri, 7 Jun 2002 13:10:25 -0700 Content-Type: text/plain; charset="us-ascii" From: "Martin M. Hunt" Organization: Red Hat Inc To: gdb-patches@sources.redhat.com Subject: [RFA] small patch to command_line_handler Date: Fri, 07 Jun 2002 13:12:00 -0000 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200206071312.07163.hunt@redhat.com> X-SW-Source: 2002-06/txt/msg00115.txt.bz2 Please check this carefully because I don't really understand the code here. I'm trying to track down some memory trashing and random crashes and the command line handler is reading memory it didn't allocate, which is mostly harmless, but annoying and bad programming. So here's a proposed fix. -- Martin Hunt GDB Engineer Red Hat, Inc. 2002-06-07 Martin M. Hunt * event-top.c (command_line_handler): Don't read past beginning of buffer. Index: event-top.c =================================================================== RCS file: /cvs/src/src/gdb/event-top.c,v retrieving revision 1.20 diff -u -u -r1.20 event-top.c --- event-top.c 27 Mar 2002 21:20:15 -0000 1.20 +++ event-top.c 7 Jun 2002 20:08:32 -0000 @@ -681,7 +681,7 @@ xfree (rl); /* Allocated in readline. */ - if (*(p - 1) == '\\') + if (p > linebuffer && *(p - 1) == '\\') { p--; /* Put on top of '\'. */