浏览代码

Fix out-of-bounds write when STL file node name is too long

Turo Lamminen 10 年之前
父节点
当前提交
792da49933
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      code/STLLoader.cpp

+ 3 - 0
code/STLLoader.cpp

@@ -229,6 +229,9 @@ void STLImporter::LoadASCIIFile()
 	size_t temp;
 	// setup the name of the node
 	if ((temp = (size_t)(sz-szMe)))	{
+		if (temp >= MAXLEN) {
+			throw DeadlyImportError( "STL: Node name too long" );
+		}
 
 		pScene->mRootNode->mName.length = temp;
 		memcpy(pScene->mRootNode->mName.data,szMe,temp);