This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: Minor off-by-one error in command_line_handler
- From: Elena Zannoni <ezannoni at redhat dot com>
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Cc: Jason Molenda <jason-swarelist at molenda dot com>, gdb-patches at sources dot redhat dot com
- Date: Wed, 27 Mar 2002 13:10:45 -0500
- Subject: Re: Minor off-by-one error in command_line_handler
- References: <20020327000106.A24311@molenda.com><3CA1F421.6010009@cygnus.com>
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;
Jason, can you sneak in a fix for that too?
Thanks
Elena