Fix an off by one error when handling a packet where our read buffer size truncates the first chunk of the packet

between the two chars representing the checksum.

<rdar://problem/11882074>

llvm-svn: 160310
This commit is contained in:
Jim Ingham 2012-07-16 18:56:05 +00:00
parent 25bdee6b5b
commit 73472eef4d
1 changed files with 2 additions and 2 deletions

View File

@ -586,7 +586,7 @@ RNBRemote::CommDataReceived(const std::string& new_data)
case '$':
// Look for a standard gdb packet?
end_idx = data.find('#', idx + 1);
if (end_idx == std::string::npos || end_idx + 2 > data_size)
if (end_idx == std::string::npos || end_idx + 3 > data_size)
{
end_idx = std::string::npos;
}
@ -594,7 +594,7 @@ RNBRemote::CommDataReceived(const std::string& new_data)
{
// Add two for the checksum bytes and 1 to point to the
// byte just past the end of this packet
end_idx += 2 + 1;
end_idx += 3;
}
break;