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

Make ulist() tolerant of NULL 'cur' parameter value and 'title'

Running 'scfg -id -w' would crash due to NULL pointer dereference and display
prompts with a "[(null)]" title. Fixed.
parent 88b58230
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -206,6 +206,10 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar
int optnumlen;
int yesno=0;
int lines;
int tmpcur;
if(cur == NULL)
cur = &tmpcur;
for(opts=0;opts<MAX_OPTS;opts++)
if(option[opts]==NULL || option[opts][0]==0)
......@@ -230,7 +234,8 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar
yesno=1;
printf("%s? ",title);
} else {
printf("\n[%s]\n",title);
if(title != NULL)
printf("\n[%s]\n",title);
lines=2;
for(i=0;i<opts;i++) {
printf("%*d: %s\n",optnumlen,i+1,option[i]);
......
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