Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions FirmataParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ void FirmataParser::processSysexMessage(void)
if ( 3 > sysexBytesRead ) {
(*currentReportFirmwareCallback)(currentReportFirmwareCallbackContext, 0, 0, (const char *)NULL);
} else {
const size_t end_of_string = (string_offset + decodeByteStream((sysexBytesRead - string_offset), &dataBuffer[string_offset]));
const size_t bytec = min(sysexBytesRead - string_offset, dataBufferSize - string_offset);
const size_t end_of_string = (string_offset + decodeByteStream(bytec, &dataBuffer[string_offset]));
bufferDataAtPosition('\0', end_of_string); // NULL terminate the string
(*currentReportFirmwareCallback)(currentReportFirmwareCallbackContext, (size_t)dataBuffer[major_version_offset], (size_t)dataBuffer[minor_version_offset], (const char *)&dataBuffer[string_offset]);
}
Expand All @@ -445,7 +446,8 @@ void FirmataParser::processSysexMessage(void)
case STRING_DATA:
if (currentStringCallback) {
const size_t string_offset = 1;
const size_t end_of_string = (string_offset + decodeByteStream((sysexBytesRead - string_offset), &dataBuffer[string_offset]));
const size_t bytec = min(sysexBytesRead - string_offset, dataBufferSize - string_offset);
const size_t end_of_string = (string_offset + decodeByteStream(bytec, &dataBuffer[string_offset]));
bufferDataAtPosition('\0', end_of_string); // NULL terminate the string
(*currentStringCallback)(currentStringCallbackContext, (const char *)&dataBuffer[string_offset]);
}
Expand Down