HF-8055: BBFDM Microservice DotSo plugin gives 9005 Invalid Parameter Name
Patches a bug in replace_str (in dmcommon.c)
This loop - for (size_t i = 0; input_str[i] != '\0'; i++) { if (strstr(&input_str[i], old_substr) == &input_str[i]) { occurrences++; i += old_substr_len; } }
runs past the end of the input_str if the matched string is at the end, as the i += old_substr_len positions places the index at the \0, but then the for loop increment is added running the index past the string.
Changing the loop to be -
for (size_t i = 0; i<strlen(input_str); i++) {
solves this problem.