1
0

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:
cutealien
2023-10-03 15:08:40 +00:00
parent b93dac3ee1
commit b6e9202272
4 changed files with 31 additions and 10 deletions

View File

@@ -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);