Movatterモバイル変換


[0]ホーム

URL:


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

Commit84b98c7

Browse files
authored
Merge pull request#193 from tttapa/patch-2
Fix stack buffer overflow in String::getBytes() test
2 parents5b9faf6 +363c2c4 commit84b98c7

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::Stringstr("Hello");
48-
unsignedchar buf[2];
48+
unsignedchar 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)

[8]ページ先頭

©2009-2025 Movatter.jp