Skip to content

Commit

Permalink
fix buffer overflow in test_security_dir
Browse files Browse the repository at this point in the history
Signed-off-by: Abby Xu <[email protected]>
  • Loading branch information
xabxx committed May 1, 2019
1 parent 64610d2 commit aa0b4b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rcl/test/rcl/test_security_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,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);
memcpy(g_envstring, putenv_input.c_str(), std::min(putenv_input.length(), sizeof(g_envstring) - 1));
putenv_wrapper(g_envstring);
/* --------------------------
* Namespace : Root
Expand Down

0 comments on commit aa0b4b1

Please sign in to comment.