[8773] Prevent counter overflow in mail list oacket sent to client.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
unik 2009-11-04 16:22:23 +03:00 committed by VladimirMangos
parent 44fb72aeff
commit 6b1e76a150
2 changed files with 8 additions and 1 deletions

View file

@ -529,6 +529,13 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
// packet send mail count as uint8, prevent overflow
if(mailsCount >= 254)
{
realCount += 1;
continue;
}
// skip deleted or not delivered (deliver delay not expired) mails
if ((*itr)->state == MAIL_STATE_DELETED || cur_time < (*itr)->deliver_time)
continue;