Merge pull request #1008 from wise86-android/coverity_scan_fix

153083/2 Buffer not null terminated
pull/2286/head
Kim Kulling 2016-09-27 23:56:36 +02:00 committed by GitHub
commit a3be51ecf3
2 changed files with 3 additions and 3 deletions

View File

@ -1557,7 +1557,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
} else { } else {
pcNode->mName.length = ::strlen(szBuffer); pcNode->mName.length = ::strlen(szBuffer);
} }
::strncpy(pcNode->mName.data,szBuffer,MAXLEN); ::strncpy(pcNode->mName.data,szBuffer,MAXLEN-1);
++p; ++p;
} }
} }

View File

@ -641,7 +641,7 @@ void SMDImporter::ComputeAbsoluteBoneTransformations()
bone.mOffsetMatrix.Inverse(); bone.mOffsetMatrix.Inverse();
} }
} }
\
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// create output materials // create output materials
void SMDImporter::CreateOutputMaterials() void SMDImporter::CreateOutputMaterials()
@ -660,7 +660,7 @@ void SMDImporter::CreateOutputMaterials()
if (aszTextures[iMat].length()) if (aszTextures[iMat].length())
{ {
::strncpy(szName.data, aszTextures[iMat].c_str(),MAXLEN ); ::strncpy(szName.data, aszTextures[iMat].c_str(),MAXLEN-1);
szName.length = aszTextures[iMat].length(); szName.length = aszTextures[iMat].length();
pcMat->AddProperty(&szName,AI_MATKEY_TEXTURE_DIFFUSE(0)); pcMat->AddProperty(&szName,AI_MATKEY_TEXTURE_DIFFUSE(0));
} }