diff --git a/src/common/Collision/Management/MMapManager.cpp b/src/common/Collision/Management/MMapManager.cpp index a91796db6fd..0feb091c59e 100644 --- a/src/common/Collision/Management/MMapManager.cpp +++ b/src/common/Collision/Management/MMapManager.cpp @@ -163,6 +163,17 @@ namespace MMAP return false; } + long pos = ftell(file); + fseek(file, 0, SEEK_END); + if (static_cast(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 d39ffc208a6..f53a4b7c36b 100644 --- a/src/server/game/Spells/SpellHistory.cpp +++ b/src/server/game/Spells/SpellHistory.cpp @@ -136,7 +136,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();) {