Skip to content

Commit

Permalink
fix potential bug of matching substrings
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Sep 21, 2023
1 parent 6416002 commit 0e9b0be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ std::vector<std::string> get_preceding_controller_names(
auto cmd_itfs = ctrl.c->command_interface_configuration().names;
for (const auto & itf : cmd_itfs)
{
if (itf.find(controller_name) != std::string::npos)
auto split_pos = itf.find_first_of('/');
if ((split_pos != std::string::npos) && (itf.substr(0, split_pos) == controller_name))
{
preceding_controllers.push_back(ctrl.info.name);
auto ctrl_names = get_preceding_controller_names(ctrl.info.name, controllers);
Expand Down

0 comments on commit 0e9b0be

Please sign in to comment.