Skip to content

Commit 026dcc7

Browse files
committed
fix heap buffer overflow in test_security_dir
1 parent 64610d2 commit 026dcc7

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

rcl/test/rcl/test_security_directory.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#define TEST_NODE_NAME "dummy_node"
2424
#define TEST_NODE_NAMESPACE ROOT_NAMESPACE TEST_SECURITY_DIRECTORY_RESOURCES_DIR_NAME
2525

26-
char g_envstring[512] = {0};
27-
2826
static int putenv_wrapper(const char * env_var)
2927
{
3028
#ifdef _WIN32
@@ -109,8 +107,7 @@ TEST_F(TestGetSecureRoot, successScenarios) {
109107
TEST_SECURITY_DIRECTORY_RESOURCES_DIR_NAME, allocator);
110108
std::string putenv_input = ROS_SECURITY_ROOT_DIRECTORY_VAR_NAME "=";
111109
putenv_input += base_lookup_dir_fqn;
112-
memcpy(g_envstring, putenv_input.c_str(), sizeof(g_envstring) - 1);
113-
putenv_wrapper(g_envstring);
110+
putenv_wrapper(putenv_input.c_str());
114111
/* --------------------------
115112
* Namespace : Root
116113
* Match type : Exact

0 commit comments

Comments
 (0)