Merge pull request #303 from edk0/modreload-uaf

modules: fix use-after-free when reloading
This commit is contained in:
Aaron Jones 2020-01-02 17:24:44 +00:00 committed by GitHub
commit 1a7927bb87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -689,6 +689,7 @@ modules_do_reload(void *info_)
struct modreload *info = info_; struct modreload *info = info_;
struct module *mod; struct module *mod;
int check_core; int check_core;
int origin;
char *m_bn = rb_basename(info->module); char *m_bn = rb_basename(info->module);
struct Client *source_p = find_id(info->id); struct Client *source_p = find_id(info->id);
@ -700,6 +701,7 @@ modules_do_reload(void *info_)
return; return;
} }
origin = mod->origin;
check_core = mod->core; check_core = mod->core;
mod_remember_clicaps(); mod_remember_clicaps();
@ -712,7 +714,7 @@ modules_do_reload(void *info_)
return; 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, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Error reloading core module: %s: terminating ircd", m_bn); "Error reloading core module: %s: terminating ircd", m_bn);