1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00

examples/arduino_hello-world: fix buffer overflow

This commit is contained in:
Mikolai Gütschow 2024-11-25 16:16:48 +01:00
parent 9edbe1503f
commit 18c6991d4a
No known key found for this signature in database
GPG Key ID: 943E2F37AA659AD5

View File

@ -25,8 +25,9 @@
// Assign the default LED pin
int ledPin = ARDUINO_LED;
#define BUF_LEN 64
// input buffer for receiving chars on the serial port
int buf[64];
int buf[BUF_LEN];
// counter that counts the number of received chars
int count = 0;
@ -64,7 +65,7 @@ void loop(void)
count = 0;
}
// else we just remember the incoming char
else {
else if (count < BUF_LEN) {
buf[count++] = tmp;
}
}