Skip to content

Commit

Permalink
Null-terminate string to dirname function (#1093)
Browse files Browse the repository at this point in the history
possibly responsible for heisenbug #1079 (comment)
  • Loading branch information
rotu authored and Carl Delsey committed Sep 3, 2019
1 parent c004f21 commit 443f56b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions nav2_map_server/src/occ_grid_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ OccGridLoader::LoadParameters OccGridLoader::load_map_yaml(const std::string & y
if (image_file_name[0] != '/') {
// dirname takes a mutable char *, so we copy into a vector
std::vector<char> fname_copy(yaml_filename.begin(), yaml_filename.end());
fname_copy.push_back('\0');
image_file_name = std::string(dirname(fname_copy.data())) + '/' + image_file_name;
}
loadParameters.image_file_name = image_file_name;
Expand Down

0 comments on commit 443f56b

Please sign in to comment.