Skip to content

Commit

Permalink
Fix possible use after free in unit_skilluse_id2
Browse files Browse the repository at this point in the history
  • Loading branch information
4144 committed Feb 15, 2021
1 parent f6c6277 commit 2299533
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/map/unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,8 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill
if (sd != NULL && sd->auto_cast_current.itemskill_instant_cast && sd->auto_cast_current.type == AUTOCAST_ITEM)
casttime = 0;

map->freeblock_lock();

// in official this is triggered even if no cast time.
clif->useskill(src, src->id, target_id, 0,0, skill_id, skill_lv, casttime);
if( casttime > 0 || temp )
Expand Down Expand Up @@ -1798,6 +1800,8 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill
if (sd != NULL && battle_config.prevent_logout_trigger & PLT_SKILL)
sd->canlog_tick = timer->gettick();

map->freeblock_unlock();

return 1;
}

Expand Down

0 comments on commit 2299533

Please sign in to comment.