From 99cd190d67a35b1d8ea976247cdbd3ebdfb1155c Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 20 Jun 2013 04:10:26 +0200 Subject: Fixed an unsafe TBL_PC* cast in battle_calc_elefix This would cause a mapserver crash whenever the function was called by a monster attack. The issue was introduced in 03956104 --- src/map/battle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index ace947aca..800d573a2 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -820,7 +820,7 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex] damage = #ifndef RENEWAL - battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, ((TBL_PC*)src), (flag?2:0)) + battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) #else battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) #endif @@ -830,7 +830,7 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 if( left ){ damage = #ifndef RENEWAL - battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, ((TBL_PC*)src), (flag?2:0)) + battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) #else battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) #endif -- cgit v1.2.3-70-g09d2