From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17612 invoked by alias); 7 Jun 2002 21:52:38 -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 17600 invoked from network); 7 Jun 2002 21:52:37 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 7 Jun 2002 21:52:37 -0000 Received: from localhost.redhat.com (remus.sfbay.redhat.com [172.16.27.252]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id OAA06904; Fri, 7 Jun 2002 14:52:32 -0700 (PDT) Received: by localhost.redhat.com (Postfix, from userid 469) id 9B25811077; Fri, 7 Jun 2002 17:51:53 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15617.11001.177860.235426@localhost.redhat.com> Date: Fri, 07 Jun 2002 14:52:00 -0000 To: "Martin M. Hunt" Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] small patch to command_line_handler In-Reply-To: <200206071312.07163.hunt@redhat.com> References: <200206071312.07163.hunt@redhat.com> X-SW-Source: 2002-06/txt/msg00116.txt.bz2 Martin M. Hunt writes: > 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. > Hmmm, odd. Martin, can you look at what happened to this thread that reported the very same error? I thought this got fixed. http://sources.redhat.com/ml/gdb-patches/2002-03/msg00533.html Thanks Elena > -- > 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 '\'. */ >