diff --git a/ion/src/shared/unicode/utf8_helper.cpp b/ion/src/shared/unicode/utf8_helper.cpp index 40bf19bb2..731268c3f 100644 --- a/ion/src/shared/unicode/utf8_helper.cpp +++ b/ion/src/shared/unicode/utf8_helper.cpp @@ -203,7 +203,7 @@ void TryAndReplacePatternsInStringByPatterns(char * text, int textMaxLength, Tex size_t replacingStringLength = strlen(replacingString); if (strncmp(&text[i], matchedString, matchedStringLength) == 0) { - didReplace = replaceFirstCharsByPattern(&text[i], matchedStringLength, replacingString, textMaxLength); + didReplace = replaceFirstCharsByPattern(&text[i], matchedStringLength, replacingString, textMaxLength - i); if (didReplace) { int delta = replacingStringLength - matchedStringLength; textLength += delta;