Skip to content

Commit

Permalink
Handle zero-length SYSEX messages
Browse files Browse the repository at this point in the history
Check that the `storedInputData` buffer is not empty before reading the command ID from the buffer.

Fixes: #151
  • Loading branch information
mchesser committed Nov 26, 2023
1 parent e130f9b commit 96c7ed1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ConfigurableFirmata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ int FirmataClass::available(void)
*/
void FirmataClass::processSysexMessage(void)
{
if (sysexBytesRead == 0) {
return;
}

switch (storedInputData[0]) { //first byte in buffer is command
case REPORT_FIRMWARE:
printFirmwareVersion();
Expand Down

0 comments on commit 96c7ed1

Please sign in to comment.