summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-03-22 15:24:22 -0300
committerpanikon <panikon@zoho.com>2014-03-22 15:24:22 -0300
commitd097f2c4b4a31885c6b04f5868563e1f48414192 (patch)
treee0210c4c2d20a621b8224f51b49f7168f8339c4f /src/map/battle.c
parentaa120720cec6ba1ddf6ec8ac6098fef6377dddc0 (diff)
downloadhercules-d097f2c4b4a31885c6b04f5868563e1f48414192.tar.gz
hercules-d097f2c4b4a31885c6b04f5868563e1f48414192.tar.bz2
hercules-d097f2c4b4a31885c6b04f5868563e1f48414192.tar.xz
hercules-d097f2c4b4a31885c6b04f5868563e1f48414192.zip
Fixed exploit in CR_ACIDDEMONSTRATION
Fixed issue 8087 http://hercules.ws/board/tracker/issue-8087-excrescent-blank-line-in-pcc/
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 91db3202c..6836aa016 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3750,7 +3750,10 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
md.damage = 0;
if (tsd) md.damage>>=1;
#endif
- if (md.damage < 0 || md.damage > INT_MAX>>1)
+ // Some monsters have totaldef higher than md.damage in some cases, leading to md.damage < 0
+ if( md.damage < 0 )
+ md.damage = 0;
+ if( md.damage > INT_MAX>>1 )
//Overflow prevention, will anyone whine if I cap it to a few billion?
//Not capped to INT_MAX to give some room for further damage increase.
md.damage = INT_MAX>>1;