This is the mail archive of the gdb-patches@sources.redhat.com 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/RFC: vCont for the remote protocol [client]



Is GDB trying to move away from alloca? The internals manual says:

   GDB can use the non-portable function `alloca' for the allocation of
   small temporary values (such as strings).

So I use it to avoid cleanups.  OTOH, it occurs to me that
rs->remote_packet_size is a bit large; OTOOH, remote.c uses this idiom
all over the place already.

I've used xmalloc instead, since the buf is used for getpkt and thus
must be remote_packet_size large.

Here's what I am about to check in.

There are two probems:


- the buffer can get very very large and that can blow the stack
- it isn't possible to audit this code (with out a deep understanding of that value) and hence demonstrate that the sprintf won't smash the stack/heap


You'll need to also change the sprintf to snprintf (parameterized with remote_packet_size.

Andrew



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