mirror of
https://github.com/minetest/minetest.git
synced 2024-07-04 15:05:27 +02:00
Check that enough bytes could be read
This commit is contained in:
parent
00d23d65e0
commit
a2311dc734
@ -729,7 +729,8 @@ std::optional<tiniergltf::GlTF> CGLTFMeshFileLoader::tryParseGLTF(io::IReadFile*
|
|||||||
{
|
{
|
||||||
auto size = file->getSize();
|
auto size = file->getSize();
|
||||||
auto buf = std::make_unique<char[]>(size + 1);
|
auto buf = std::make_unique<char[]>(size + 1);
|
||||||
file->read(buf.get(), size);
|
if (file->read(buf.get(), size) < size)
|
||||||
|
return std::nullopt;
|
||||||
// We probably don't need this, but add it just to be sure.
|
// We probably don't need this, but add it just to be sure.
|
||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
Json::CharReaderBuilder builder;
|
Json::CharReaderBuilder builder;
|
||||||
|
Loading…
Reference in New Issue
Block a user