[Lldb-commits] [lldb] r160310 - /lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Jim Ingham jingham at apple.com
Mon Jul 16 11:56:05 PDT 2012


Author: jingham
Date: Mon Jul 16 13:56:05 2012
New Revision: 160310

URL: http://llvm.org/viewvc/llvm-project?rev=160310&view=rev
Log:
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>

Modified:
    lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=160310&r1=160309&r2=160310&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Mon Jul 16 13:56:05 2012
@@ -586,7 +586,7 @@
                 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 @@
                     {
                         // 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;
 





More information about the lldb-commits mailing list