summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-21 03:51:23 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-27 19:09:23 +0300
commit3280c97ff6cd7e8dd5d40b4af28d0eadfbd5f33d (patch)
treea97f5dc4433b0ad573e73613b2184e054fe5943e /src/map
parent19f90ec6999ef55d1f9521bab9895420e8c7abae (diff)
downloadhercules-3280c97ff6cd7e8dd5d40b4af28d0eadfbd5f33d.tar.gz
hercules-3280c97ff6cd7e8dd5d40b4af28d0eadfbd5f33d.tar.bz2
hercules-3280c97ff6cd7e8dd5d40b4af28d0eadfbd5f33d.tar.xz
hercules-3280c97ff6cd7e8dd5d40b4af28d0eadfbd5f33d.zip
Fix use after free error in @reloadatcommand gm command.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 2bcb22738..b0ad24c11 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -10056,6 +10056,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
{
char params[100], command[100];
char output[CHAT_SIZE_MAX];
+ bool logCommand;
// Reconstructed message
char atcmd_msg[CHAT_SIZE_MAX];
@@ -10199,6 +10200,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
}
}
+ logCommand = info->log;
//Attempt to use the command
if ((info->func(fd, ssd, command, params,info) != true)) {
#ifdef AUTOTRADE_PERSISTENCY
@@ -10210,7 +10212,8 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
return true;
}
- if (info->log) /* log only if this command should be logged [Ind/Hercules] */
+ // info->log cant be used here, because info can be freed [4144]
+ if (logCommand) /* log only if this command should be logged [Ind/Hercules] */
logs->atcommand(sd, is_atcommand ? atcmd_msg : message);
return true;