String already adds a null terminator

This commit is contained in:
Riyyi
2021-02-04 01:38:08 +01:00
parent 989e0f10ac
commit bbd84df19c
+2 -2
View File
@@ -29,14 +29,14 @@ namespace Inferno {
}
// Allocate memory filled with zeros
auto buffer = std::make_unique<char[]>(length + 1);
auto buffer = std::make_unique<char[]>(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);
}
}