Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: Andrew Cagney <ac131313@cygnus.com>,
	Jason Molenda <jason-swarelist@molenda.com>,
	gdb-patches@sources.redhat.com
Subject: Re: Minor off-by-one error in command_line_handler
Date: Wed, 27 Mar 2002 11:54:00 -0000	[thread overview]
Message-ID: <jelmcdlrbm.fsf@sykes.suse.de> (raw)
In-Reply-To: <15522.2853.891361.517767@localhost.redhat.com> (Elena Zannoni's message of "Wed, 27 Mar 2002 13:10:45 -0500")

Elena Zannoni <ezannoni@redhat.com> 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."


  reply	other threads:[~2002-03-27 19:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-27  0:01 Jason Molenda
2002-03-27  8:34 ` Andrew Cagney
2002-03-27 10:11   ` Elena Zannoni
2002-03-27 11:54     ` Andreas Schwab [this message]
2002-03-27 13:31       ` Elena Zannoni
2002-03-27 13:21         ` Andreas Schwab
2002-03-27  9:40 ` Andrew Cagney
2002-03-28 23:54 ` Daniel Jacobowitz
2002-03-30 21:05   ` Andrew Cagney
2002-03-30 21:08     ` Daniel Jacobowitz
2002-04-03 19:27       ` Andrew Cagney
2002-04-09 13:52     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jelmcdlrbm.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=ac131313@cygnus.com \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jason-swarelist@molenda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox