Hi, I think this line can cause buffer overflow:
because index can equal to bufferSize after this:
|
} else if (index < bufferSize) { |
|
buffer[index] = ch; |
|
index++; |
I suggest to fix it by replacing else if (index < bufferSize) with else if (index < bufferSize - 1), ensuring that one byte is always left for the zero termination character.
Hi, I think this line can cause buffer overflow:
Arduino-StaticSerialCommands/src/StaticSerialCommands.cpp
Line 73 in 35f192e
because
indexcan equal tobufferSizeafter this:Arduino-StaticSerialCommands/src/StaticSerialCommands.cpp
Lines 77 to 79 in 35f192e
I suggest to fix it by replacing
else if (index < bufferSize)withelse if (index < bufferSize - 1), ensuring that one byte is always left for the zero termination character.