Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 84b98c7

Browse files
Merge pull request #193 from tttapa/patch-2
Fix stack buffer overflow in String::getBytes() test
2 parents 5b9faf6 + 363c2c4 commit 84b98c7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

‎test/CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ add_compile_definitions(HOST)
121121
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
122122
add_compile_options(-Wno-cast-function-type)
123123

124-
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "--coverage")
125-
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--coverage -Wno-deprecated-copy")
124+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
125+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -Wno-deprecated-copy")
126126

127127
##########################################################################
128128

‎test/src/String/test_characterAccessFunc.cpp‎

Lines changed: 2 additions & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /