This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Resubmit reverse debugging [5/5]


El miÃ, 08-10-2008 a las 15:14 -0300, Thiago Jung Bauermann escribiÃ:
> El mar, 07-10-2008 a las 19:20 -0700, Michael Snyder escribiÃ:
> > +static void
> > +exec_reverse_once (char *cmd, char *args, int from_tty)
> > +{
> > +  /* String buffer for command consing.  */
> > +  char reverse_command[512];
> <snip>
> > +  sprintf (reverse_command, "%s %s", cmd, args ? args : "");
> > +
> > +  execution_direction = EXEC_REVERSE;
> > +  execute_command (reverse_command, from_tty);
> > +  do_cleanups (old_chain);
> 
> That fixed-length buffer being written with sprintf doesn't look good...
> What do you think about using xstrprintf instead? That will remove the
> possibility of buffer overflow, and also remove an arbitrary limit.

By the way, the string manipulation can be avoided if you pass a
function pointer to exec_reverse_once. Then you can call it passing
next_command, continue_command and all others. It seems cleaner to me,
what do you think?

Also, will there be anything added to reverse.c in the future? If not,
IMHO it's easier just to put these command definitions and setup in
infcmd.c, next to their forward counterparts.
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]