Skip to content
Snippets Groups Projects
Commit aa7a9640 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Range-check the cfg.new_shell value before using as index into array

If a configuration had *no* command shells, this would have caused a crash here in SCFG.

Also, when selecting the new user command shell, default to the current selection.
parent 7ef33bc8
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3597 passed
......@@ -958,7 +958,7 @@ void sys_cfg(void)
sprintf(opt[i++],"%-27.27s%s","Editor"
,cfg.new_xedit);
sprintf(opt[i++],"%-27.27s%s","Command Shell"
,cfg.shell[cfg.new_shell]->code);
,cfg.new_shell >= cfg.total_shells ? "<invalid>" : cfg.shell[cfg.new_shell]->code);
if(cfg.new_prot!=' ')
sprintf(str,"%c",cfg.new_prot);
else
......@@ -1123,7 +1123,7 @@ void sys_cfg(void)
for(i=0;i<cfg.total_shells && i<MAX_OPTS;i++)
sprintf(opt[i],"%-.*s", LEN_CODE, cfg.shell[i]->code);
opt[i][0]=0;
i=0;
i=cfg.new_shell;
uifc.helpbuf=
"`New User Command Shell:`\n"
"\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment