diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index 799368264..aeefa5a04 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -493,12 +493,12 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( aiString szFile; const size_t iLen = strlen((const char *)szCurrent); - size_t iLen2 = iLen + 1; - iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2; + size_t iLen2 = iLen > MAXLEN - 1 ? MAXLEN - 1: iLen; memcpy(szFile.data, (const char *)szCurrent, iLen2); + szFile.data[iLen2] = '\0'; szFile.length = static_cast(iLen2); - szCurrent += iLen2; + szCurrent += iLen2 + 1; // place this as diffuse texture pcMatOut->AddProperty(&szFile, AI_MATKEY_TEXTURE_DIFFUSE(0));