From 4f47fccbbec978f4446077d395076b1805eedb83 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 20 Dec 2023 15:14:17 -0600 Subject: [PATCH] Use sprintf instead of strcpy Signed-off-by: Addisu Z. Taddese --- ros_gz_sim/src/create.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ros_gz_sim/src/create.cpp b/ros_gz_sim/src/create.cpp index c58e9c4f..ab504f20 100644 --- a/ros_gz_sim/src/create.cpp +++ b/ros_gz_sim/src/create.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -60,7 +59,7 @@ int main(int _argc, char ** _argv) char ** filtered_argv = new char *[(filtered_argc + 1)]; for (int ii = 0; ii < filtered_argc; ++ii) { filtered_argv[ii] = new char[filtered_arguments[ii].size() + 1]; - std::strcpy(filtered_argv[ii], filtered_arguments[ii].c_str()); + snprintf(filtered_argv[ii], filtered_arguments[ii].size() + 1, "%s", filtered_arguments[ii].c_str()); } filtered_argv[filtered_argc] = nullptr;