Dependents:
Nucleo_cobs_test
Revision 3:41c9f2bbeeb2, committed 2015-07-22
- Comitter:
- glansberry
- Date:
- Wed Jul 22 21:34:08 2015 -0400
- Parent:
- 2:64fdac5efaa1
- Commit message:
- Fix bug causeing always fail
Changed in this revision
diff -r 64fdac5efaa1 -r 41c9f2bbeeb2 COBS.cpp
--- a/COBS.cpp Tue Jul 21 19:31:41 2015 -0400
+++ b/COBS.cpp Wed Jul 22 21:34:08 2015 -0400
@@ -57,7 +57,7 @@
while (ptr < end)
{
int i, code = *ptr++;
- if (ptr+code > end) return 1; //if we will overun the end of the buffer exit
+ if (ptr+code-1 > end) return 1; //if we will overun the end of the buffer exit
//this is most likely to happen when decoding a malformed message
for (i=1; i<code; i++) *dst++ = *ptr++;
if (code < 0xFF) *dst++ = 0;