mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-15 00:07:13 +00:00
fix(zone): lengths and counts in zone files are checked against what is left of the file
A string length, the path chunk's length and an object's render technique count are compared with the bytes left before memory is set aside for them. The terrain reader is built into dCommon, so every server that reads zone files has it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,7 @@ void ZoneFile::Read(std::istream& file) {
|
||||
if (fileFormatVersion >= FileFormatVersion::EarlyAlpha) {
|
||||
// The paths are a chunk of their own (LuzFile::ReadLUZFile copies it, ReadLUZPaths reads it)
|
||||
BinaryIO::BinaryRead(file, pathDataLength);
|
||||
BinaryIO::RequireRemaining(file, pathDataLength);
|
||||
std::string chunk(pathDataLength, '\0');
|
||||
file.read(chunk.data(), static_cast<std::streamsize>(chunk.size()));
|
||||
if (!file) throw std::runtime_error("Failed to read from istream.");
|
||||
|
||||
Reference in New Issue
Block a user