Browse Source

Change strcpy to strncpy for format hint safety (#6365)

Kim Kulling 1 week ago
parent
commit
f28a96121d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      code/AssetLib/M3D/M3DImporter.cpp

+ 1 - 1
code/AssetLib/M3D/M3DImporter.cpp

@@ -332,7 +332,7 @@ void M3DImporter::importTextures(const M3DWrapper &m3d) {
             /* if we have the texture loaded, set format hint and pcData too */
             /* if we have the texture loaded, set format hint and pcData too */
             tx->mWidth = t->w;
             tx->mWidth = t->w;
             tx->mHeight = t->h;
             tx->mHeight = t->h;
-            strcpy(tx->achFormatHint, formatHint[t->f - 1]);
+            strncpy(tx->achFormatHint, formatHint[t->f - 1], 8);
             tx->pcData = new aiTexel[tx->mWidth * tx->mHeight];
             tx->pcData = new aiTexel[tx->mWidth * tx->mHeight];
             for (j = k = 0; j < tx->mWidth * tx->mHeight; j++) {
             for (j = k = 0; j < tx->mWidth * tx->mHeight; j++) {
                 switch (t->f) {
                 switch (t->f) {