From ebe39998815d6d99f3ac57f35b59545a38ceac96 Mon Sep 17 00:00:00 2001 From: Ivan Mogilko Date: Tue, 31 Oct 2023 03:25:24 +0300 Subject: [PATCH] Engine: small safety fix for ScriptString::Unserialize() --- Engine/ac/dynobj/scriptstring.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/ac/dynobj/scriptstring.cpp b/Engine/ac/dynobj/scriptstring.cpp index 8099c491bde..82bc4e4412e 100644 --- a/Engine/ac/dynobj/scriptstring.cpp +++ b/Engine/ac/dynobj/scriptstring.cpp @@ -57,6 +57,8 @@ void ScriptString::Unserialize(int index, Stream *in, size_t /*data_sz*/) Header &hdr = reinterpret_cast(*buf); hdr.Length = len; hdr.ULength = ustrlen(text_ptr); + hdr.LastCharIdx = 0u; + hdr.LastCharOff = 0u; ccRegisterUnserializedObject(index, text_ptr, this); }