Skip to content

Commit 0587f4b

Browse files
author
Jacky Boen
committed
check for buffer overflow
Signed-off-by: Jacky Boen <aqiank@gmail.com>
1 parent 02a6e0b commit 0587f4b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Arduino/serialindex/IO.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ void IO::read(char c)
7979
{
8080
buffer[ibuffer++] = c;
8181

82+
if (ibuffer >= BUFFERSIZE) {
83+
ibuffer = 0;
84+
context = Context::Skip;
85+
}
86+
8287
switch (context) {
8388
case Context::Key:
8489
read_key(c);

0 commit comments

Comments
 (0)