Fix stack overflow in remoteMemoryRead
When doing a remote memory read the debugger can ask for any size. The buffer being allocated however was only 1024 bytes long and the code in remoteMemoryRead also attempts to write a zero byte at the end of the array. This code will now take the count of bytes the debugger is trying to read and allocates a buffer that is count * 2 + 1 large. This is large enough to hold the $02x formatted hex byte for each byte as well as the zero byte written at the end.
This commit is contained in:
parent
4f28e84632
commit
dd2a1d9b51
|
@ -3684,7 +3684,7 @@ void remoteMemoryRead(char* p)
|
|||
sscanf(p, "%x,%x:", &address, &count);
|
||||
// monprintf("Memory read for %08x %d\n", address, count);
|
||||
|
||||
char buffer[1024];
|
||||
char buffer[(count*2)+1];
|
||||
|
||||
char* s = buffer;
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
|
Loading…
Reference in New Issue