1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Fix convert buffer, wrong allocation size

This commit is contained in:
Ted John
2017-01-03 19:27:35 +00:00
parent a277419855
commit cb592726d9

View File

@@ -492,9 +492,10 @@ private:
bool result = false;
if (len != 0 && cvt->len_mult != 0)
{
if (_convertBuffer == nullptr || _convertBufferCapacity < len)
size_t reqConvertBufferCapacity = len * cvt->len_mult;
if (_convertBuffer == nullptr || _convertBufferCapacity < reqConvertBufferCapacity)
{
_convertBufferCapacity = len * cvt->len_mult;
_convertBufferCapacity = reqConvertBufferCapacity;
_convertBuffer = realloc(_convertBuffer, _convertBufferCapacity);
}
Memory::Copy(_convertBuffer, src, len);