diff options
| author | jackpoz <giacomopoz@gmail.com> | 2013-09-21 19:44:15 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2013-09-21 19:44:15 +0200 |
| commit | af63c8783e48b6a618f7406857d6bc56d142d390 (patch) | |
| tree | 1f699c0caca7fd5c7552b2abc36fd5e84a474680 /src | |
| parent | 9c336cc32e26999b8155d52885f6cc83152109d5 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Guilds/Guild.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index cc15d15fdf9..b766897988d 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -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; |
