From 6aa5c725ff0ba2c97e637adf0cd1977ec639451f Mon Sep 17 00:00:00 2001 From: Ed Kellett Date: Thu, 2 Jan 2020 16:39:35 +0000 Subject: [PATCH] modules: fix use-after-free when reloading --- ircd/modules.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ircd/modules.c b/ircd/modules.c index 8cbf5113..7a246cbe 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -689,6 +689,7 @@ modules_do_reload(void *info_) struct modreload *info = info_; struct module *mod; int check_core; + int origin; char *m_bn = rb_basename(info->module); struct Client *source_p = find_id(info->id); @@ -700,6 +701,7 @@ modules_do_reload(void *info_) return; } + origin = mod->origin; check_core = mod->core; mod_remember_clicaps(); @@ -712,7 +714,7 @@ modules_do_reload(void *info_) return; } - if((load_one_module(m_bn, mod->origin, check_core) == false) && check_core) + if((load_one_module(m_bn, origin, check_core) == false) && check_core) { sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Error reloading core module: %s: terminating ircd", m_bn);