From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1018 invoked by alias); 27 Mar 2002 19:54:34 -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 945 invoked from network); 27 Mar 2002 19:54:32 -0000 Received: from unknown (HELO Cantor.suse.de) (213.95.15.193) by sources.redhat.com with SMTP; 27 Mar 2002 19:54:32 -0000 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id C012D1EA41; Wed, 27 Mar 2002 20:54:31 +0100 (MET) X-Authentication-Warning: sykes.suse.de: schwab set sender to schwab@suse.de using -f To: Elena Zannoni Cc: Andrew Cagney , Jason Molenda , gdb-patches@sources.redhat.com Subject: Re: Minor off-by-one error in command_line_handler References: <20020327000106.A24311@molenda.com> <3CA1F421.6010009@cygnus.com> <15522.2853.891361.517767@localhost.redhat.com> X-Yow: .. I think I'd better go back to my DESK and toy with a few common MISAPPREHENSIONS... From: Andreas Schwab Date: Wed, 27 Mar 2002 11:54:00 -0000 In-Reply-To: <15522.2853.891361.517767@localhost.redhat.com> (Elena Zannoni's message of "Wed, 27 Mar 2002 13:10:45 -0500") Message-ID: User-Agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2.50 (ia64-suse-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2002-03/txt/msg00545.txt.bz2 Elena Zannoni writes: |> Andrew Cagney writes: |> > > 2002-03-26 Jason Molenda (jason-cl@molenda.com) |> > > |> > > * event-top.c (command_line_handler): Don't check penultimate |> > > byte in zero-length strings. |> > > |> > > |> > Yes, and thanks. |> > |> > Andrew |> > |> > |> |> Wait. This is fine, but, as the comments indicate, the code was taken |> from the function command_line_input in top.c, which has the same bug: |> |> p1 = rl; |> /* Copy line. Don't copy null at end. (Leaves line alone |> if this was just a newline) */ |> while (*p1) |> *p++ = *p1++; |> |> xfree (rl); /* Allocated in readline. */ |> |> if (p == linebuffer || *(p - 1) != '\\') |> break; Why? This one looks ok. Btw., command_line_handler has this: if (*(p - 1) == '\\') { p--; /* Put on top of '\'. */ if (*p == '\\') The condition in the last line is always true. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."