Skip to content

Commit

Permalink
fix heap buffer overflow in test_security_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
xabxx committed Apr 29, 2019
1 parent 64610d2 commit 026dcc7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions rcl/test/rcl/test_security_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#define TEST_NODE_NAME "dummy_node"
#define TEST_NODE_NAMESPACE ROOT_NAMESPACE TEST_SECURITY_DIRECTORY_RESOURCES_DIR_NAME

char g_envstring[512] = {0};

static int putenv_wrapper(const char * env_var)
{
#ifdef _WIN32
Expand Down Expand Up @@ -109,8 +107,7 @@ TEST_F(TestGetSecureRoot, successScenarios) {
TEST_SECURITY_DIRECTORY_RESOURCES_DIR_NAME, allocator);
std::string putenv_input = ROS_SECURITY_ROOT_DIRECTORY_VAR_NAME "=";
putenv_input += base_lookup_dir_fqn;
memcpy(g_envstring, putenv_input.c_str(), sizeof(g_envstring) - 1);
putenv_wrapper(g_envstring);
putenv_wrapper(putenv_input.c_str());
/* --------------------------
* Namespace : Root
* Match type : Exact
Expand Down

0 comments on commit 026dcc7

Please sign in to comment.