Merge pull request #21 from sundhaug92/master

GDB: Range-checking for 'p' and 'P' ops
This commit is contained in:
Zach Bacon 2016-09-09 06:59:04 -04:00 committed by GitHub
commit b80ea69a12
1 changed files with 11 additions and 0 deletions

View File

@ -3945,6 +3945,11 @@ void remoteReadRegister(char* p)
{
int r;
sscanf(p, "%x", &r);
if(r < 0 || r > 15)
{
remotePutPacket("E 00");
return;
}
char buffer[1024];
char* s = buffer;
uint32_t v = reg[r].I;
@ -3997,6 +4002,12 @@ void remoteWriteRegister(char* p)
sscanf(p, "%x=", &r);
if(r < 0 || r > 15)
{
remotePutPacket("E 00");
return;
}
p = strchr(p, '=');
p++;