Commit 2962e4a5 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Fix segfault when printing Bad-echo name after failing to load cfg

This is a weird one: sbbsecho ran right as I was saving msgs.cnf via
SCFG and it seems like it loaded 0-byte msgs.cnf into memory and this
segfault was a result of trying to print sub[INVALID_SUB]->code.

The use of [f]nopen() with proper share perms should have prevented this
(truncated msgs.cnf read) from happening, so there's something else afoot here.
parent dc4b1bd9
Pipeline #3001 passed with stage
in 9 minutes and 33 seconds
...@@ -6467,7 +6467,8 @@ int main(int argc, char **argv) ...@@ -6467,7 +6467,8 @@ int main(int argc, char **argv)
} }
if(cfg.badecho >= 0) if(cfg.badecho >= 0)
lprintf(LOG_DEBUG, "Bad-echo area: %s", scfg.sub[cfg.area[cfg.badecho].sub]->code); lprintf(LOG_DEBUG, "Bad-echo area: %s"
,cfg.area[cfg.badecho].sub == INVALID_SUB ? "INVALID_SUB" : scfg.sub[cfg.area[cfg.badecho].sub]->code);
if(cfg.auto_add_subs) { if(cfg.auto_add_subs) {
for(unsigned subnum = 0; subnum < scfg.total_subs; subnum++) { for(unsigned subnum = 0; subnum < scfg.total_subs; subnum++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment