Pārlūkot izejas kodu

122143,122139 Copy into fixed size buffer

wise86Android 9 gadi atpakaļ
vecāks
revīzija
07ec476b7d
2 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 1 1
      code/MDLLoader.cpp
  2. 1 1
      code/SMDLoader.cpp

+ 1 - 1
code/MDLLoader.cpp

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

+ 1 - 1
code/SMDLoader.cpp

@@ -660,7 +660,7 @@ void SMDImporter::CreateOutputMaterials()
 
 
         if (aszTextures[iMat].length())
         if (aszTextures[iMat].length())
         {
         {
-            ::strcpy(szName.data, aszTextures[iMat].c_str() );
+            ::strncpy(szName.data, aszTextures[iMat].c_str(),MAXLEN );
             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));
         }
         }