[yaml parser] Fix FQN=//node_name when ns is / (#299)
* Fix FQN=//node_name when ns is / * Check end of string for ns sep * Add regression test
This commit is contained in:
parent
0a6d9186e8
commit
f1293b7d3b
3 changed files with 40 additions and 1 deletions
|
@ -187,7 +187,14 @@ static rcl_ret_t add_name_to_ns(
|
|||
ns_len = strlen(cur_ns);
|
||||
name_len = strlen(name);
|
||||
sep_len = strlen(sep_str);
|
||||
tot_len = ns_len + name_len + sep_len + 1U;
|
||||
// Check the last sep_len characters of the current NS against the separator string.
|
||||
if (strcmp(cur_ns + ns_len - sep_len, sep_str) == 0) {
|
||||
// Current NS already ends with the separator: don't put another separator in.
|
||||
sep_len = 0;
|
||||
sep_str = "";
|
||||
}
|
||||
|
||||
tot_len = ns_len + sep_len + name_len + 1U;
|
||||
|
||||
if (tot_len > MAX_STRING_SIZE) {
|
||||
RCL_SET_ERROR_MSG("New namespace string is exceeding max string size",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue