Change RNBRemote::HandlePacket_m() to store the packet on the heap

instead of on the stack.  Handles larger packet read requests better.

llvm-svn: 201118
This commit is contained in:
Jason Molenda 2014-02-11 00:48:29 +00:00
parent da276f9013
commit e54a0bfcd3
1 changed files with 6 additions and 1 deletions

View File

@ -2476,7 +2476,11 @@ RNBRemote::HandlePacket_m (const char *p)
return SendPacket ("");
}
uint8_t buf[length];
uint8_t *buf = (uint8_t *)malloc (length);
if (buf == NULL)
{
return SendPacket ("E78");
}
int bytes_read = DNBProcessMemoryRead (m_ctx.ProcessID(), addr, length, buf);
if (bytes_read == 0)
{
@ -2490,6 +2494,7 @@ RNBRemote::HandlePacket_m (const char *p)
std::ostringstream ostrm;
for (int i = 0; i < length; i++)
ostrm << RAWHEX8(buf[i]);
free (buf);
return SendPacket (ostrm.str ());
}