From 3280c97ff6cd7e8dd5d40b4af28d0eadfbd5f33d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Feb 2018 03:51:23 +0300 Subject: Fix use after free error in @reloadatcommand gm command. --- src/map/atcommand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2