[UTIL] Fixed bug in TranslateUnicodeString code

It was incorrectly copying length in bytes instead
of character count which was causing out of bounds access and string corruption
This commit is contained in:
Gliniak 2024-09-13 12:21:21 +02:00
parent c7c71b5b6b
commit d232bdbecf
1 changed files with 1 additions and 1 deletions

View File

@ -116,7 +116,7 @@ inline std::u16string TranslateUnicodeString(
unicode_string->pointer); unicode_string->pointer);
std::u16string translated_string; std::u16string translated_string;
translated_string.reserve(length); translated_string.reserve(length);
for (uint16_t i = 0; i < length; ++i) { for (uint16_t i = 0; i < length / sizeof(uint16_t); ++i) {
translated_string += char16_t(uint16_t(guest_string[i])); translated_string += char16_t(uint16_t(guest_string[i]));
} }
return translated_string; return translated_string;