aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Collision/Management/MMapManager.cpp11
-rw-r--r--src/server/game/Spells/SpellHistory.cpp1
2 files changed, 11 insertions, 1 deletions
diff --git a/src/common/Collision/Management/MMapManager.cpp b/src/common/Collision/Management/MMapManager.cpp
index e5f503bf70a..cec5c0da7f0 100644
--- a/src/common/Collision/Management/MMapManager.cpp
+++ b/src/common/Collision/Management/MMapManager.cpp
@@ -154,6 +154,17 @@ namespace MMAP
return false;
}
+ long pos = ftell(file);
+ fseek(file, 0, SEEK_END);
+ if (static_cast<int32>(fileHeader.size) > ftell(file) - pos)
+ {
+ TC_LOG_ERROR("maps", "MMAP:loadMap: %03u%02i%02i.mmtile has corrupted data size", mapId, x, y);
+ fclose(file);
+ return false;
+ }
+
+ fseek(file, pos, SEEK_SET);
+
unsigned char* data = (unsigned char*)dtAlloc(fileHeader.size, DT_ALLOC_PERM);
ASSERT(data);
diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp
index 808da17dbd6..00edb2672b2 100644
--- a/src/server/game/Spells/SpellHistory.cpp
+++ b/src/server/game/Spells/SpellHistory.cpp
@@ -137,7 +137,6 @@ void SpellHistory::SaveToDB(SQLTransaction& trans)
void SpellHistory::Update()
{
- SQLTransaction t;
Clock::time_point now = Clock::now();
for (auto itr = _categoryCooldowns.begin(); itr != _categoryCooldowns.end();)
{