gdb_main.c: fix buffer overflow on large reads
When gdb issues a `m xx,200` command, the probe should respond with a packet of size 2*0x200=1024 which is the size of the packet buffer. However, the `hexify()` procedures writes 1025 bytes in the buffer. During my tests, it caused the probe to hang when issuing a `dump` command. Presumably by overwritting the `cur_target` variable.
This commit is contained in:
parent
2d7b24c566
commit
c9d3cf71dd
|
@ -41,7 +41,7 @@
|
||||||
#define ERROR_IF_NO_TARGET() \
|
#define ERROR_IF_NO_TARGET() \
|
||||||
if(!cur_target) { gdb_putpacketz("EFF"); break; }
|
if(!cur_target) { gdb_putpacketz("EFF"); break; }
|
||||||
|
|
||||||
static char pbuf[BUF_SIZE];
|
static char pbuf[BUF_SIZE+1];
|
||||||
|
|
||||||
static target *cur_target;
|
static target *cur_target;
|
||||||
static target *last_target;
|
static target *last_target;
|
||||||
|
|
Loading…
Reference in New Issue