From 6f4f7c4d75c9d563e98d3936ed8bc6e248dc14a8 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 18 Sep 2023 21:39:56 +0200 Subject: [PATCH] CXMeshFileLoader: fix buffer overreads with text format --- source/Irrlicht/CXMeshFileLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Irrlicht/CXMeshFileLoader.cpp b/source/Irrlicht/CXMeshFileLoader.cpp index c06cd177..108ce179 100644 --- a/source/Irrlicht/CXMeshFileLoader.cpp +++ b/source/Irrlicht/CXMeshFileLoader.cpp @@ -396,7 +396,8 @@ bool CXMeshFileLoader::readFileIntoMemory(io::IReadFile* file) return false; } - Buffer = new c8[size]; + Buffer = new c8[size+1]; + Buffer[size] = 0x0; // null-terminate //! read all into memory if (file->read(Buffer, size) != static_cast(size))