[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:
parent
c7c71b5b6b
commit
d232bdbecf
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue