Fix an integer overflow in LcfReader::ReadString resulting in a heap corruption.
Thanks to
Fixes
MODIFY
src/reader_lcf.cpp
src/reader_lcf.cpp
@@ -160,10 +160,9 @@ void LcfReader::Read<uint32_t>(std::vector<uint32_t> &buffer, size_t size) {
}
void LcfReader::ReadString(std::string& ref, size_t size) {
- char* chars = new char[size + 1];
- chars[size] = '\0';
+ char* chars = new char[size];
Read(chars, 1, size);
- ref = Encode(std::string(chars));
+ ref = Encode(std::string(chars, size));
delete[] chars;
}

Fix an integer overflow in LcfReader::ReadString resulting in a heap corruption.

Thanks to @scrippie

Fixes #194