1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Guard against EfunctionAdd() from outside MOD_TEST.

As this can keep someone busy for half an hour wondering why things crash...
This commit is contained in:
Bram Matthys
2026-03-28 10:35:05 +01:00
parent eb798510fd
commit 8bfc599697
+9
View File
@@ -202,6 +202,15 @@ Efunction *EfunctionAddMain(Module *module, EfunctionType eftype, int (*func)(),
module->errorcode = MODERR_INVALID;
return NULL;
}
if (loop.config_status != CONFIG_STATUS_TEST)
{
unreal_log(ULOG_ERROR, "module", "BUG_EFUNCTIONADD_NOT_MOD_TEST", NULL,
"[BUG] EfunctionAdd() called by module '$module_name' outside of MOD_TEST().",
log_data_string("module_name", module->header->name));
module->errorcode = MODERR_INVALID;
return NULL;
}
p = safe_alloc(sizeof(Efunction));
if (func)