mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: Prevent crashing server with CMSG_TIME_SYNC_RESP and fixed some warnings
This commit is contained in:
@@ -248,7 +248,7 @@ inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCSt
|
||||
// compatibility format and C++ structure sizes
|
||||
ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T),
|
||||
"Size of '%s' set by format string (%u) not equal size of C++ structure (%u).",
|
||||
filename.c_str(), DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T));
|
||||
filename.c_str(), DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), uint32(sizeof(T)));
|
||||
|
||||
++DBCFileCount;
|
||||
std::string dbcFilename = dbcPath + filename;
|
||||
@@ -296,7 +296,7 @@ inline void LoadGameTable(StoreProblemList& errors, std::string const& tableName
|
||||
// compatibility format and C++ structure sizes
|
||||
ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T),
|
||||
"Size of '%s' set by format string (%u) not equal size of C++ structure (%u).",
|
||||
filename.c_str(), DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T));
|
||||
filename.c_str(), DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), uint32(sizeof(T)));
|
||||
|
||||
++DBCFileCount;
|
||||
std::string dbcFilename = dbcPath + filename;
|
||||
|
||||
@@ -1498,6 +1498,13 @@ void WorldSession::HandleTimeSyncResp(WorldPackets::Misc::TimeSyncResponse& pack
|
||||
{
|
||||
TC_LOG_DEBUG("network", "CMSG_TIME_SYNC_RESP");
|
||||
|
||||
// Prevent crashing server if queue is empty
|
||||
if (_player->m_timeSyncQueue.empty())
|
||||
{
|
||||
TC_LOG_ERROR("network", "Received CMSG_TIME_SYNC_RESP from player %s without requesting it (hacker?)", _player->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.SequenceIndex != _player->m_timeSyncQueue.front())
|
||||
TC_LOG_ERROR("network", "Wrong time sync counter from player %s (cheater?)", _player->GetName().c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user