Skip to content

Commit 4db8959

Browse files
committed
test: fix buffer overflow in String::getBytes test
1 parent 5b9faf6 commit 4db8959

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/src/String/test_characterAccessFunc.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ TEST_CASE ("Testing String::getBytes(unsigned char, unsigned int, unsigned int)"
4545

4646
WHEN("Valid operation") {
4747
arduino::String str("Hello");
48-
unsigned char buf[2];
48+
unsigned char buf[3];
4949
str.getBytes(buf, 5, 3);
5050
REQUIRE(buf[0] == 'l');
5151
REQUIRE(buf[1] == 'o');
52+
REQUIRE(buf[2] == '\0');
5253
}
5354
}
5455

0 commit comments

Comments
 (0)