summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-06-11 10:36:39 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-06-11 10:36:39 +0000
commit542ad876951945fccf8687618e380e9e60ff25ee (patch)
tree758a95af5c58073f739cbac08f7c1df500686d69
parent2e5e8e8c9a1f663992dab375573081a2856b265f (diff)
downloadhercules-542ad876951945fccf8687618e380e9e60ff25ee.tar.gz
hercules-542ad876951945fccf8687618e380e9e60ff25ee.tar.bz2
hercules-542ad876951945fccf8687618e380e9e60ff25ee.tar.xz
hercules-542ad876951945fccf8687618e380e9e60ff25ee.zip
Adjusted the code order in clif_parse_gmkick() to avoid invalid pointer access crashes when kicking mobs/npcs (bugreport:3229).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13880 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/clif.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 160724eec..f0062517f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10703,21 +10703,26 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
clif_GM_kickack(sd, 0);
return;
}
- clif_GM_kick(sd, tsd);
+
if(log_config.gm && lv >= log_config.gm) {
char message[256];
sprintf(message, "/kick %s (%d)", tsd->status.name, tsd->status.char_id);
log_atcommand(sd, message);
}
+
+ clif_GM_kick(sd, tsd);
}
break;
case BL_MOB:
- status_percent_damage(&sd->bl, target, 100, 0, true);
+ {
if(log_config.gm && lv >= log_config.gm) {
char message[256];
sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
log_atcommand(sd, message);
}
+
+ status_percent_damage(&sd->bl, target, 100, 0, true); // can invalidate 'target'
+ }
break;
case BL_NPC:
{
@@ -10725,15 +10730,17 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
lv = get_atcommand_level(atcommand_unloadnpc);
if( pc_isGM(sd) < lv )
return;
- // copy-pasted from atcommand_unloadnpc
- npc_unload_duplicates(nd);
- npc_unload(nd);
- npc_read_event_script();
+
if( log_config.gm && lv >= log_config.gm ) {
char message[256];
sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
log_atcommand(sd, message);
}
+
+ // copy-pasted from atcommand_unloadnpc
+ npc_unload_duplicates(nd);
+ npc_unload(nd); // invalidates 'target'
+ npc_read_event_script();
}
break;
default: