From bbd84df19c7cf81bd104c76eac6c079289e84ea1 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 4 Feb 2021 01:38:08 +0100 Subject: [PATCH] String already adds a null terminator --- inferno/src/inferno/io/file.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inferno/src/inferno/io/file.cpp b/inferno/src/inferno/io/file.cpp index 6b1d4db..4399e27 100644 --- a/inferno/src/inferno/io/file.cpp +++ b/inferno/src/inferno/io/file.cpp @@ -29,14 +29,14 @@ namespace Inferno { } // Allocate memory filled with zeros - auto buffer = std::make_unique(length + 1); + auto buffer = std::make_unique(length); // Fill buffer with file contents file.read(buffer.get(), length); file.close(); // Create string from the buffer and return - return std::string(buffer.get(), length + 1); + return std::string(buffer.get(), length); } }