mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 04:42:10 +01:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user