Fix static analysis issues

CID 1291964
CID 1292775

(cherry picked from commit 6767bbc95f)

Conflicts:
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Spells/SpellHistory.h
	src/server/game/Spells/SpellInfo.cpp
This commit is contained in:
Shauren
2017-01-17 20:14:44 +01:00
committed by Aokromes
parent 304ecbc8b1
commit bbcd694155
2 changed files with 11 additions and 1 deletions

View File

@@ -163,6 +163,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);

View File

@@ -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();)
{