Merging r6551 through r6553 from branch releases/1.8 to trunk
All about bounds checks and preventing buffer overruns in b3d and obj files based on sfan5 patches for Minetest git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6554 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@@ -74,13 +74,14 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
const io::path fullName = file->getFileName();
|
||||
const io::path relPath = FileSystem->getFileDir(fullName)+"/";
|
||||
|
||||
c8* buf = new c8[filesize];
|
||||
c8* buf = new c8[filesize+1]; // plus null-terminator (some string functions used in parsing)
|
||||
filesize = file->read((void*)buf, filesize);
|
||||
if ( filesize <= 0 )
|
||||
{
|
||||
delete[] buf;
|
||||
return 0;
|
||||
}
|
||||
buf[filesize] = 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
Reference in New Issue
Block a user