aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/map_extractor/System.cpp3
-rw-r--r--src/tools/map_extractor/loadlib.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index bd258420613..72af10067b4 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -273,7 +273,7 @@ uint32 ReadBuild(int locale)
exit(1);
}
- std::string text = buff;
+ std::string text = std::string(buff, readBytes);
CascCloseFile(dbcFile);
size_t pos = text.find("version=\"");
@@ -358,6 +358,7 @@ void ReadAreaTableDBC()
size_t area_count = dbc.getRecordCount();
maxAreaId = dbc.getMaxId();
areas = new uint16[maxAreaId + 1];
+ memset(areas, 0xFF, sizeof(uint16) * (maxAreaId + 1));
for (uint32 x = 0; x < area_count; ++x)
areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp
index 975aef04773..b594b21a9c9 100644
--- a/src/tools/map_extractor/loadlib.cpp
+++ b/src/tools/map_extractor/loadlib.cpp
@@ -111,7 +111,8 @@ bool IsInterestingChunk(u_map_fcc const& fcc)
void ChunkedFile::parseChunks()
{
uint8* ptr = GetData();
- while (ptr < GetData() + GetDataSize())
+ // Make sure there's enough data to read u_map_fcc struct and the uint32 size after it
+ while (ptr <= GetData() + GetDataSize() - 8)
{
u_map_fcc header = *(u_map_fcc*)ptr;
if (IsInterestingChunk(header))