summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-22 09:37:47 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-22 09:37:47 +0000
commit7928947b09b3e7b7f317379d16f9b47299d26cee (patch)
treef11a38cba1034265f427273cbf6196b948bb8a46 /src/map/status.c
parente5b1b4c350134f4304a9d3b4858f99ecf235b31f (diff)
downloadhercules-7928947b09b3e7b7f317379d16f9b47299d26cee.tar.gz
hercules-7928947b09b3e7b7f317379d16f9b47299d26cee.tar.bz2
hercules-7928947b09b3e7b7f317379d16f9b47299d26cee.tar.xz
hercules-7928947b09b3e7b7f317379d16f9b47299d26cee.zip
* Changed val4 of SC_BLADESTOP from a block_list pointer to an id. (64bit portability issue and potential dangling pointer crash)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13471 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 5b38fd17a..e8da71bcc 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4549,9 +4549,10 @@ void status_set_viewdata(struct block_list *bl, int class_)
vd->cloth_color = 0;
}
+/// Returns the status_change data of bl or NULL if it doesn't exist.
struct status_change *status_get_sc(struct block_list *bl)
{
- nullpo_retr(NULL, bl);
+ if( bl )
switch (bl->type) {
case BL_PC: return &((TBL_PC*)bl)->sc;
case BL_MOB: return &((TBL_MOB*)bl)->sc;
@@ -6582,15 +6583,16 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
case SC_BLADESTOP:
if(sce->val4)
{
- struct block_list *tbl = (struct block_list *)sce->val4;
+ int tid = sce->val4;
+ struct block_list *tbl = map_id2bl(tid);
struct status_change *tsc = status_get_sc(tbl);
sce->val4 = 0;
- if(tsc && tsc->data[SC_BLADESTOP])
+ if(tbl && tsc && tsc->data[SC_BLADESTOP])
{
tsc->data[SC_BLADESTOP]->val4 = 0;
status_change_end(tbl,SC_BLADESTOP,-1);
}
- clif_bladestop(bl,tbl,0);
+ clif_bladestop(bl, tid, 0);
}
break;
case SC_DANCING: