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: [PATCH] Use rs->buf after getpkt


On 01/25/2014 12:16 PM, Yao Qi wrote:
> Hi,
> The following code snippet looks wrong to me
> 
>  char *buf = rs->buf;
> 
>  getpkt (&rs->buf, &rs->buf_size, 0);
>  packet_ok (buf, );
> 
> if rs->buf is reallocated in getpkt, buf points to an out of dated
> memory. 

Indeed.

> This patch removes local 'buf' and uses rs->buf.
> 
> Regression tested on x86_64-linux.  Is it OK?

OK.

-- 
Pedro Alves


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