Core/Guild: Fix withdraw money from bank overflowing int32 limit

Clamp amount of money withdrawn from bank to MAX_MONEY_AMOUNT to avoid int32 overflow which would remove money from Player instead of adding it.
This commit is contained in:
jackpoz
2013-09-21 19:44:15 +02:00
parent 9c336cc32e
commit af63c8783e

View File

@@ -1762,6 +1762,9 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair)
{
//clamp amount to MAX_MONEY_AMOUNT, Players can't hold more than that anyway
amount = std::min(amount, uint32(MAX_MONEY_AMOUNT));
if (m_bankMoney < amount) // Not enough money in bank
return false;