diff --git a/src/jrd/intl_classes.h b/src/jrd/intl_classes.h index e7279ab0d4..714f40877e 100644 --- a/src/jrd/intl_classes.h +++ b/src/jrd/intl_classes.h @@ -87,7 +87,10 @@ public: UpcaseConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len) : PrevConverter(pool, obj, str, len) { - obj->str_to_upper(len, str, len, tempBuffer.getBuffer(len, false)); + const auto charSet = obj->getCharSet(); + const auto bufferSize = len / charSet->minBytesPerChar() * charSet->maxBytesPerChar(); + + len = obj->str_to_upper(len, str, bufferSize, tempBuffer.getBuffer(bufferSize, false)); str = tempBuffer.begin(); }