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

Prevent heap corruption by bounds-checking writes to opt[]

Since we are now free()ing the opt[] items in bail(), I've seen heap
corruption core dumps after navigating the SCFG menus with some long
configuration items (e.g. timed events with max-length command-lines).
This heap corruption has been present for a long, long time, but not
detected since we weren't free()ing these heap-allocated items.
Increasing MAX_OPLN would have been a mitigation for this issue, but
using snprintf(opt[n],MAX_OPLN,...) is the better fix.
parent 9c7ecc89
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4320 passed
......@@ -1043,7 +1043,7 @@ void txt_cfg()
while(1) {
for(i=0;i<cfg.total_txtsecs;i++)
sprintf(opt[i],"%-25s",cfg.txtsec[i]->name);
snprintf(opt[i],MAX_OPLN,"%-25s",cfg.txtsec[i]->name);
opt[i][0]=0;
j=WIN_ORG|WIN_ACT|WIN_CHE;
if(cfg.total_txtsecs)
......@@ -1154,9 +1154,9 @@ void txt_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27s%s","Name",cfg.txtsec[i]->name);
sprintf(opt[k++],"%-27.27s%s","Internal Code",cfg.txtsec[i]->code);
sprintf(opt[k++],"%-27.27s%s","Access Requirements"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Name",cfg.txtsec[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Internal Code",cfg.txtsec[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Access Requirements"
,cfg.txtsec[i]->arstr);
opt[k][0]=0;
uifc_winmode_t wmode = WIN_ACT|WIN_MID|WIN_EXTKEYS;
......@@ -1227,7 +1227,7 @@ void shell_cfg()
while(1) {
for(i=0;i<cfg.total_shells;i++)
sprintf(opt[i],"%-25s",cfg.shell[i]->name);
snprintf(opt[i],MAX_OPLN,"%-25s",cfg.shell[i]->name);
opt[i][0]=0;
j=WIN_ORG|WIN_ACT|WIN_CHE;
if(cfg.total_shells)
......@@ -1343,9 +1343,9 @@ void shell_cfg()
while(!done) {
static int bar;
k=0;
sprintf(opt[k++],"%-27.27s%s","Name",cfg.shell[i]->name);
sprintf(opt[k++],"%-27.27s%s","Internal Code",cfg.shell[i]->code);
sprintf(opt[k++],"%-27.27s%s","Access Requirements"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Name",cfg.shell[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Internal Code",cfg.shell[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Access Requirements"
,cfg.shell[i]->arstr);
opt[k][0]=0;
uifc.helpbuf=
......@@ -1702,7 +1702,7 @@ void getar(char *desc, char *inar)
SAFECOPY(ar,str);
}
i=0;
sprintf(opt[i++],"Requirement String (%s)",ar);
snprintf(opt[i++],MAX_OPLN,"Requirement String (%s)",ar);
strcpy(opt[i++],"Clear Requirements");
strcpy(opt[i++],"Set Required Level");
strcpy(opt[i++],"Set Required Flag");
......@@ -1818,7 +1818,7 @@ void getar(char *desc, char *inar)
}
for(i=0;i<4;i++)
sprintf(opt[i],"Flag Set #%d",i+1);
snprintf(opt[i],MAX_OPLN,"Flag Set #%d",i+1);
opt[i][0]=0;
i=0;
i=uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Select Flag Set",opt);
......
......@@ -31,7 +31,7 @@ void page_cfg()
while(1) {
for(i=0;i<cfg.total_pages && i<MAX_OPTS;i++)
sprintf(opt[i],"%-40.40s %-.20s",cfg.page[i]->cmd,cfg.page[i]->arstr);
snprintf(opt[i],MAX_OPLN,"%-40.40s %-.20s",cfg.page[i]->cmd,cfg.page[i]->arstr);
opt[i][0]=0;
j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT;
if(cfg.total_pages)
......@@ -113,12 +113,12 @@ void page_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27s%s","Command Line",cfg.page[i]->cmd);
sprintf(opt[k++],"%-27.27s%s","Access Requirements",cfg.page[i]->arstr);
sprintf(opt[k++],"%-27.27s%s","I/O Method", io_method(cfg.page[i]->misc));
sprintf(opt[k++],"%-27.27s%s","Native Executable"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Command Line",cfg.page[i]->cmd);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Access Requirements",cfg.page[i]->arstr);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","I/O Method", io_method(cfg.page[i]->misc));
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Native Executable"
,cfg.page[i]->misc&XTRN_NATIVE ? "Yes" : "No");
sprintf(opt[k++],"%-27.27s%s","Use Shell to Execute"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Use Shell to Execute"
,cfg.page[i]->misc&XTRN_SH ? "Yes" : "No");
opt[k][0]=0;
sprintf(str,"Sysop Chat Pager #%d",i+1);
......@@ -212,7 +212,7 @@ void chan_cfg()
while(1) {
for(i=0;i<cfg.total_chans && i<MAX_OPTS;i++)
sprintf(opt[i],"%-25s",cfg.chan[i]->name);
snprintf(opt[i],MAX_OPLN,"%-25s",cfg.chan[i]->name);
opt[i][0]=0;
j=WIN_ACT|WIN_SAV|WIN_BOT|WIN_RHT;
if(cfg.total_chans)
......@@ -312,18 +312,18 @@ void chan_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27s%s","Name",cfg.chan[i]->name);
sprintf(opt[k++],"%-27.27s%s","Internal Code",cfg.chan[i]->code);
sprintf(opt[k++],"%-27.27s%"PRIu32,"Cost in Credits",cfg.chan[i]->cost);
sprintf(opt[k++],"%-27.27s%.40s","Access Requirements"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Name",cfg.chan[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Internal Code",cfg.chan[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%"PRIu32,"Cost in Credits",cfg.chan[i]->cost);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%.40s","Access Requirements"
,cfg.chan[i]->arstr);
sprintf(opt[k++],"%-27.27s%s","Password Protection"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Password Protection"
,cfg.chan[i]->misc&CHAN_PW ? "Yes" : "No");
sprintf(opt[k++],"%-27.27s%s","Guru Joins When Empty"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Guru Joins When Empty"
,cfg.chan[i]->misc&CHAN_GURU ? "Yes" : "No");
sprintf(opt[k++],"%-27.27s%s","Channel Guru"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Channel Guru"
,cfg.chan[i]->guru<cfg.total_gurus ? cfg.guru[cfg.chan[i]->guru]->name : "");
sprintf(opt[k++],"%-27.27s%s","Channel Action Set"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Channel Action Set"
,cfg.chan[i]->actset < cfg.total_actsets ? cfg.actset[cfg.chan[i]->actset]->name : "INVALID!");
opt[k][0]=0;
uifc.helpbuf=
......@@ -446,7 +446,7 @@ void chan_cfg()
;
k=0;
for(j=0;j<cfg.total_gurus && j<MAX_OPTS;j++)
sprintf(opt[j],"%-25s",cfg.guru[j]->name);
snprintf(opt[j],MAX_OPLN,"%-25s",cfg.guru[j]->name);
opt[j][0]=0;
k=uifc.list(WIN_SAV|WIN_RHT,0,0,25,&guru_dflt,0
,"Available Chat Gurus",opt);
......@@ -463,7 +463,7 @@ void chan_cfg()
;
k=0;
for(j=0;j<cfg.total_actsets && j<MAX_OPTS;j++)
sprintf(opt[j],"%-25s",cfg.actset[j]->name);
snprintf(opt[j],MAX_OPLN,"%-25s",cfg.actset[j]->name);
opt[j][0]=0;
k=uifc.list(WIN_SAV|WIN_RHT,0,0,25,&j,0
,"Available Chat Action Sets",opt);
......@@ -488,7 +488,7 @@ void chatact_cfg(uint setnum)
while(1) {
for(i=0,j=0;i<cfg.total_chatacts && j<MAX_OPTS;i++)
if(cfg.chatact[i]->actset==setnum) {
sprintf(opt[j],"%-*.*s %s",LEN_CHATACTCMD,LEN_CHATACTCMD
snprintf(opt[j],MAX_OPLN,"%-*.*s %s",LEN_CHATACTCMD,LEN_CHATACTCMD
,cfg.chatact[i]->cmd,cfg.chatact[i]->out);
chatnum[j++]=i;
}
......@@ -619,7 +619,7 @@ void guru_cfg()
while(1) {
for(i=0;i<cfg.total_gurus && i<MAX_OPTS;i++)
sprintf(opt[i],"%-25s",cfg.guru[i]->name);
snprintf(opt[i],MAX_OPLN,"%-25s",cfg.guru[i]->name);
opt[i][0]=0;
j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT;
if(cfg.total_gurus)
......@@ -717,9 +717,9 @@ void guru_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27s%s","Guru Name",cfg.guru[i]->name);
sprintf(opt[k++],"%-27.27s%s","Guru Internal Code",cfg.guru[i]->code);
sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",cfg.guru[i]->arstr);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Guru Name",cfg.guru[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Guru Internal Code",cfg.guru[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%.40s","Access Requirements",cfg.guru[i]->arstr);
opt[k][0]=0;
uifc.helpbuf=
"`Guru Configuration:`\n"
......@@ -792,7 +792,7 @@ void actsets_cfg()
while(1) {
for(i=0;i<cfg.total_actsets && i<MAX_OPTS;i++)
sprintf(opt[i],"%-25s",cfg.actset[i]->name);
snprintf(opt[i],MAX_OPLN,"%-25s",cfg.actset[i]->name);
opt[i][0]=0;
j=WIN_ACT|WIN_RHT|WIN_BOT|WIN_SAV;
if(cfg.total_actsets)
......@@ -874,8 +874,8 @@ void actsets_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27s%s","Action Set Name",cfg.actset[i]->name);
sprintf(opt[k++],"%-27.27s","Configure Chat Actions...");
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Action Set Name",cfg.actset[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-27.27s","Configure Chat Actions...");
opt[k][0]=0;
uifc.helpbuf=
"`Chat Action Set Configuration:`\n"
......
......@@ -496,7 +496,7 @@ void msgs_cfg()
while(1) {
for(i=0;i<cfg.total_grps && i<MAX_OPTS;i++)
sprintf(opt[i],"%-*s %5u", LEN_GLNAME, cfg.grp[i]->lname, subs_in_group(i));
snprintf(opt[i],MAX_OPLN,"%-*s %5u", LEN_GLNAME, cfg.grp[i]->lname, subs_in_group(i));
opt[i][0]=0;
int mode = WIN_ORG|WIN_ACT|WIN_CHE;
if(cfg.total_grps)
......@@ -652,12 +652,12 @@ void msgs_cfg()
done=0;
while(!done) {
j=0;
sprintf(opt[j++],"%-27.27s%s","Long Name",cfg.grp[grpnum]->lname);
sprintf(opt[j++],"%-27.27s%s","Short Name",cfg.grp[grpnum]->sname);
sprintf(opt[j++],"%-27.27s%s","Internal Code Prefix",cfg.grp[grpnum]->code_prefix);
sprintf(opt[j++],"%-27.27s%s","Access Requirements"
snprintf(opt[j++],MAX_OPLN,"%-27.27s%s","Long Name",cfg.grp[grpnum]->lname);
snprintf(opt[j++],MAX_OPLN,"%-27.27s%s","Short Name",cfg.grp[grpnum]->sname);
snprintf(opt[j++],MAX_OPLN,"%-27.27s%s","Internal Code Prefix",cfg.grp[grpnum]->code_prefix);
snprintf(opt[j++],MAX_OPLN,"%-27.27s%s","Access Requirements"
,cfg.grp[grpnum]->arstr);
sprintf(opt[j++],"%-27.27s%s","Sort Group by Sub-board", area_sort_desc[cfg.grp[grpnum]->sort]);
snprintf(opt[j++],MAX_OPLN,"%-27.27s%s","Sort Group by Sub-board", area_sort_desc[cfg.grp[grpnum]->sort]);
strcpy(opt[j++],"Clone Options");
strcpy(opt[j++],"Export Areas...");
strcpy(opt[j++],"Import Areas...");
......@@ -1102,61 +1102,61 @@ void msg_opts()
while(1) {
i=0;
sprintf(opt[i++],"%-33.33s%s"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s"
,"BBS ID for QWK Packets",cfg.sys_id);
sprintf(opt[i++],"%-33.33s%u seconds"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%u seconds"
,"Maximum Retry Time",cfg.smb_retry_time);
if(cfg.max_qwkmsgs)
sprintf(str,"%"PRIu32,cfg.max_qwkmsgs);
else
sprintf(str,"Unlimited");
sprintf(opt[i++],"%-33.33s%s"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s"
,"Maximum QWK Messages",str);
if(cfg.max_qwkmsgage)
sprintf(str,"%u days",cfg.max_qwkmsgage);
else
sprintf(str,"Unlimited");
sprintf(opt[i++],"%-33.33s%s"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s"
,"Maximum QWK Message Age",str);
sprintf(opt[i++],"%-33.33s%s","Pre-pack QWK Requirements",cfg.preqwk_arstr);
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Pre-pack QWK Requirements",cfg.preqwk_arstr);
if(cfg.mail_maxage)
SAFEPRINTF(str,"Enabled (%u days old)",cfg.mail_maxage);
else
SAFECOPY(str,"Disabled");
sprintf(opt[i++],"%-33.33s%s","Purge E-mail by Age",str);
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Purge E-mail by Age",str);
if(cfg.max_spamage)
SAFEPRINTF(str,"Enabled (%u days old)",cfg.max_spamage);
else
SAFECOPY(str,"Disabled");
sprintf(opt[i++],"%-33.33s%s","Purge SPAM by Age",str);
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Purge SPAM by Age",str);
if(cfg.sys_misc&SM_DELEMAIL)
SAFECOPY(str,"Immediately");
else
SAFECOPY(str,"Daily");
sprintf(opt[i++],"%-33.33s%s","Purge Deleted E-mail",str);
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Purge Deleted E-mail",str);
if(cfg.mail_maxcrcs)
SAFEPRINTF(str,"Enabled (%"PRIu32" mail CRCs)",cfg.mail_maxcrcs);
else
SAFECOPY(str,"Disabled");
sprintf(opt[i++],"%-33.33s%s","Duplicate E-mail Checking",str);
sprintf(opt[i++],"%-33.33s%s","Allow Anonymous E-mail"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Duplicate E-mail Checking",str);
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Allow Anonymous E-mail"
,cfg.sys_misc&SM_ANON_EM ? "Yes" : "No");
sprintf(opt[i++],"%-33.33s%s","Allow Quoting in E-mail"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Allow Quoting in E-mail"
,cfg.sys_misc&SM_QUOTE_EM ? "Yes" : "No");
sprintf(opt[i++],"%-33.33s%s","Allow Uploads in E-mail"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Allow Uploads in E-mail"
,cfg.sys_misc&SM_FILE_EM ? "Yes" : "No");
sprintf(opt[i++],"%-33.33s%s","Allow Forwarding to NetMail"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Allow Forwarding to NetMail"
,cfg.sys_misc&SM_FWDTONET ? "Yes" : "No");
sprintf(opt[i++],"%-33.33s%s","Kill Read E-mail"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Kill Read E-mail"
,cfg.sys_misc&SM_DELREADM ? "Yes" : "No");
sprintf(opt[i++],"%-33.33s%s","Receive E-mail by Real Name"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Receive E-mail by Real Name"
,cfg.msg_misc&MM_REALNAME ? "Yes" : "No");
sprintf(opt[i++],"%-33.33s%s","Include Signatures in E-mail"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Include Signatures in E-mail"
,cfg.msg_misc&MM_EMAILSIG ? "Yes" : "No");
sprintf(opt[i++],"%-33.33s%s","Users Can View Deleted Messages"
snprintf(opt[i++],MAX_OPLN,"%-33.33s%s","Users Can View Deleted Messages"
,cfg.sys_misc&SM_USRVDELM ? "Yes" : cfg.sys_misc&SM_SYSVDELM
? "Sysops Only":"No");
sprintf(opt[i++],"%-33.33s%hu","Days of New Messages for Guest", cfg.guest_msgscan_init);
snprintf(opt[i++],MAX_OPLN,"%-33.33s%hu","Days of New Messages for Guest", cfg.guest_msgscan_init);
strcpy(opt[i++],"Extra Attribute Codes...");
opt[i][0]=0;
uifc.helpbuf=
......@@ -1489,15 +1489,15 @@ void msg_opts()
j=0;
while(1) {
i=0;
sprintf(opt[i++],"%-15.15s %-3.3s","WWIV"
snprintf(opt[i++],MAX_OPLN,"%-15.15s %-3.3s","WWIV"
,cfg.sys_misc&SM_WWIV ? "Yes":"No");
sprintf(opt[i++],"%-15.15s %-3.3s","PCBoard"
snprintf(opt[i++],MAX_OPLN,"%-15.15s %-3.3s","PCBoard"
,cfg.sys_misc&SM_PCBOARD ? "Yes":"No");
sprintf(opt[i++],"%-15.15s %-3.3s","Wildcat"
snprintf(opt[i++],MAX_OPLN,"%-15.15s %-3.3s","Wildcat"
,cfg.sys_misc&SM_WILDCAT ? "Yes":"No");
sprintf(opt[i++],"%-15.15s %-3.3s","Celerity"
snprintf(opt[i++],MAX_OPLN,"%-15.15s %-3.3s","Celerity"
,cfg.sys_misc&SM_CELERITY ? "Yes":"No");
sprintf(opt[i++],"%-15.15s %-3.3s","Renegade"
snprintf(opt[i++],MAX_OPLN,"%-15.15s %-3.3s","Renegade"
,cfg.sys_misc&SM_RENEGADE ? "Yes":"No");
opt[i][0]=0;
j=uifc.list(WIN_BOT|WIN_RHT|WIN_SAV,2,2,0,&j,0
......
......@@ -113,7 +113,7 @@ uint getgrp(char* title)
int i;
for(i=0;i<cfg.total_grps && i<MAX_OPTS;i++)
sprintf(opt[i], "%-25s", cfg.grp[i]->lname);
snprintf(opt[i], MAX_OPLN, "%-25s", cfg.grp[i]->lname);
opt[i][0]=0;
return uifc.list(WIN_SAV|WIN_RHT|WIN_BOT,0,0,0,&grp_dflt,&grp_bar, title, opt);
}
......@@ -131,7 +131,7 @@ uint getsub(void)
return(-1);
for(j=k=0;j<cfg.total_subs && k<MAX_OPTS;j++)
if(cfg.sub[j]->grp==i) {
sprintf(opt[k],"%-25s",cfg.sub[j]->lname);
snprintf(opt[k],MAX_OPLN,"%-25s",cfg.sub[j]->lname);
subnum[k++]=j;
}
opt[k][0]=0;
......
This diff is collapsed.
......@@ -366,9 +366,9 @@ void fevents_cfg()
while(1) {
i=0;
sprintf(opt[i++],"%-32.32s%s","Logon Event",cfg.sys_logon);
sprintf(opt[i++],"%-32.32s%s","Logout Event",cfg.sys_logout);
sprintf(opt[i++],"%-32.32s%s","Daily Event",cfg.sys_daily);
snprintf(opt[i++],MAX_OPLN,"%-32.32s%s","Logon Event",cfg.sys_logon);
snprintf(opt[i++],MAX_OPLN,"%-32.32s%s","Logout Event",cfg.sys_logout);
snprintf(opt[i++],MAX_OPLN,"%-32.32s%s","Daily Event",cfg.sys_daily);
opt[i][0]=0;
uifc.helpbuf=
"`External Events:`\n"
......@@ -440,7 +440,7 @@ void tevents_cfg()
while(1) {
for(i=0;i<cfg.total_events && i<MAX_OPTS;i++)
sprintf(opt[i],"%-*s %s"
snprintf(opt[i], MAX_OPLN, "%-*s %s"
,LEN_CODE
,cfg.event[i]->code
,(cfg.event[i]->misc&EVENT_DISABLED) ? "<DISABLED>" : cfg.event[i]->cmd);
......@@ -509,43 +509,43 @@ void tevents_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-32.32s%s","Internal Code",cfg.event[i]->code);
sprintf(opt[k++],"%-32.32s%s","Start-up Directory",cfg.event[i]->dir);
sprintf(opt[k++],"%-32.32s%s","Command Line",cfg.event[i]->cmd);
sprintf(opt[k++],"%-32.32s%s","Enabled"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Internal Code",cfg.event[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Start-up Directory",cfg.event[i]->dir);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Command Line",cfg.event[i]->cmd);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Enabled"
,cfg.event[i]->misc&EVENT_DISABLED ? "No":"Yes");
if(cfg.event[i]->node == NODE_ANY)
SAFECOPY(str, "Any");
else
SAFEPRINTF(str, "%u", cfg.event[i]->node);
sprintf(opt[k++],"%-32.32s%s","Execution Node", str);
sprintf(opt[k++],"%-32.32s%s","Execution Months"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Execution Node", str);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Execution Months"
,monthstr(cfg.event[i]->months));
sprintf(opt[k++],"%-32.32s%s","Execution Days of Month"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Execution Days of Month"
,mdaystr(cfg.event[i]->mdays));
sprintf(opt[k++],"%-32.32s%s","Execution Days of Week",daystr(cfg.event[i]->days));
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Execution Days of Week",daystr(cfg.event[i]->days));
if(cfg.event[i]->freq) {
sprintf(str,"%u times a day",1440/cfg.event[i]->freq);
sprintf(opt[k++],"%-32.32s%s","Execution Frequency",str);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Execution Frequency",str);
} else {
sprintf(str,"%2.2u:%2.2u"
,cfg.event[i]->time/60,cfg.event[i]->time%60);
sprintf(opt[k++],"%-32.32s%s","Execution Time",str);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Execution Time",str);
}
sprintf(opt[k++],"%-32.32s%s","Requires Exclusive Execution"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Requires Exclusive Execution"
,cfg.event[i]->misc&EVENT_EXCL ? "Yes":"No");
sprintf(opt[k++],"%-32.32s%s","Force Users Off-line For Event"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Force Users Off-line For Event"
,cfg.event[i]->misc&EVENT_FORCE ? "Yes":"No");
sprintf(opt[k++],"%-32.32s%s","Native Executable/Script"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Native Executable/Script"
,cfg.event[i]->misc&EX_NATIVE ? "Yes" : "No");
sprintf(opt[k++],"%-32.32s%s",use_shell_opt
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s",use_shell_opt
,cfg.event[i]->misc&XTRN_SH ? "Yes" : "No");
sprintf(opt[k++],"%-32.32s%s","Background Execution"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Background Execution"
,cfg.event[i]->misc&EX_BG ? "Yes" : "No");
sprintf(opt[k++],"%-32.32s%s","Always Run After Init/Re-init"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Always Run After Init/Re-init"
,cfg.event[i]->misc&EVENT_INIT ? "Yes":"No");
if(!(cfg.event[i]->misc&EX_BG))
sprintf(opt[k++],"%-32.32s%s","Error Log Level", iniLogLevelStringList()[cfg.event[i]->errlevel]);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Error Log Level", iniLogLevelStringList()[cfg.event[i]->errlevel]);
opt[k][0]=0;
uifc.helpbuf=
"`Timed Event:`\n"
......@@ -1073,7 +1073,7 @@ void xtrn_cfg(uint section)
while(1) {
for(i=0,j=0;i<cfg.total_xtrns && j<MAX_OPTS;i++)
if(cfg.xtrn[i]->sec==section) {
sprintf(opt[j],"%-25s",cfg.xtrn[i]->name);
snprintf(opt[j],MAX_OPLN,"%-25s",cfg.xtrn[i]->name);
xtrnnum[j++]=i;
}
xtrnnum[j]=cfg.total_xtrns;
......@@ -1165,27 +1165,27 @@ void xtrn_cfg(uint section)
i=xtrnnum[i];
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27s%s","Name",cfg.xtrn[i]->name);
sprintf(opt[k++],"%-27.27s%s","Internal Code",cfg.xtrn[i]->code);
sprintf(opt[k++],"%-27.27s%s","Start-up Directory",cfg.xtrn[i]->path);
sprintf(opt[k++],"%-27.27s%s","Command Line",cfg.xtrn[i]->cmd);
sprintf(opt[k++],"%-27.27s%s","Clean-up Command Line",cfg.xtrn[i]->clean);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Name",cfg.xtrn[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Internal Code",cfg.xtrn[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Start-up Directory",cfg.xtrn[i]->path);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Command Line",cfg.xtrn[i]->cmd);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Clean-up Command Line",cfg.xtrn[i]->clean);
if(cfg.xtrn[i]->cost)
sprintf(str,"%"PRIu32" credits",cfg.xtrn[i]->cost);
else
strcpy(str,"None");
sprintf(opt[k++],"%-27.27s%s","Execution Cost",str);
sprintf(opt[k++],"%-27.27s%s","Access Requirements",cfg.xtrn[i]->arstr);
sprintf(opt[k++],"%-27.27s%s","Execution Requirements"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Execution Cost",str);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Access Requirements",cfg.xtrn[i]->arstr);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Execution Requirements"
,cfg.xtrn[i]->run_arstr);
sprintf(opt[k++],"%-27.27s%s","Multiple Concurrent Users"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Multiple Concurrent Users"
,cfg.xtrn[i]->misc&MULTIUSER ? "Yes" : "No");
sprintf(opt[k++],"%-27.27s%s","I/O Method", io_method(cfg.xtrn[i]->misc));
sprintf(opt[k++],"%-27.27s%s","Native Executable/Script"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","I/O Method", io_method(cfg.xtrn[i]->misc));
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Native Executable/Script"
,cfg.xtrn[i]->misc&XTRN_NATIVE ? "Yes" : "No");
sprintf(opt[k++],"%-27.27s%s",use_shell_opt
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s",use_shell_opt
,cfg.xtrn[i]->misc&XTRN_SH ? "Yes" : "No");
sprintf(opt[k++],"%-27.27s%s","Modify User Data"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Modify User Data"
,cfg.xtrn[i]->misc&MODUSERDAT ? "Yes" : "No");
switch(cfg.xtrn[i]->event) {
case EVENT_LOGON:
......@@ -1218,17 +1218,17 @@ void xtrn_cfg(uint section)
}
if((cfg.xtrn[i]->misc&EVENTONLY) && cfg.xtrn[i]->event)
strcat(str,", Only");
sprintf(opt[k++],"%-27.27s%s","Execute on Event",str);
sprintf(opt[k++],"%-27.27s%s","Pause After Execution"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Execute on Event",str);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Pause After Execution"
,cfg.xtrn[i]->misc&XTRN_PAUSE ? "Yes" : "No");
sprintf(opt[k++],"%-27.27s%s","Disable Local Display"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Disable Local Display"
,cfg.xtrn[i]->misc&XTRN_NODISPLAY ? "Yes" : "No");
sprintf(opt[k++],"%-23.23s%-4s%s","BBS Drop File Type"
snprintf(opt[k++],MAX_OPLN,"%-23.23s%-4s%s","BBS Drop File Type"
,cfg.xtrn[i]->misc&REALNAME ? "(R)":nulstr
,dropfile(cfg.xtrn[i]->type,cfg.xtrn[i]->misc));
sprintf(opt[k++],"%-27.27s%s","Place Drop File In"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Place Drop File In"
,cfg.xtrn[i]->misc&STARTUPDIR ? "Start-Up Directory":cfg.xtrn[i]->misc&XTRN_TEMP_DIR ? "Temp Directory" : "Node Directory");
sprintf(opt[k++],"Time Options...");
snprintf(opt[k++],MAX_OPLN,"Time Options...");
opt[k][0]=0;
uifc.helpbuf=
"`Online Program Configuration:`\n"
......@@ -1768,7 +1768,7 @@ void xedit_cfg()
while(1) {
for(i=0;i<cfg.total_xedits && i<MAX_OPTS;i++)
sprintf(opt[i],"%-*s %s", LEN_CODE, cfg.xedit[i]->code, cfg.xedit[i]->rcmd);
snprintf(opt[i],MAX_OPLN,"%-*s %s", LEN_CODE, cfg.xedit[i]->code, cfg.xedit[i]->rcmd);
opt[i][0]=0;
j=WIN_SAV|WIN_ACT|WIN_CHE|WIN_RHT;
if(cfg.total_xedits)
......@@ -1851,16 +1851,16 @@ void xedit_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-32.32s%s","Name",cfg.xedit[i]->name);
sprintf(opt[k++],"%-32.32s%s","Internal Code",cfg.xedit[i]->code);
sprintf(opt[k++],"%-32.32s%s","Command Line",cfg.xedit[i]->rcmd);
sprintf(opt[k++],"%-32.32s%s","Access Requirements",cfg.xedit[i]->arstr);
sprintf(opt[k++],"%-32.32s%s","I/O Method", io_method(cfg.xedit[i]->misc));
sprintf(opt[k++],"%-32.32s%s","Native Executable/Script"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Name",cfg.xedit[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Internal Code",cfg.xedit[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Command Line",cfg.xedit[i]->rcmd);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Access Requirements",cfg.xedit[i]->arstr);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","I/O Method", io_method(cfg.xedit[i]->misc));
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Native Executable/Script"
,cfg.xedit[i]->misc&XTRN_NATIVE ? "Yes" : "No");
sprintf(opt[k++],"%-32.32s%s",use_shell_opt
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s",use_shell_opt
,cfg.xedit[i]->misc&XTRN_SH ? "Yes" : "No");
sprintf(opt[k++],"%-32.32s%s","Record Terminal Width"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Record Terminal Width"
,cfg.xedit[i]->misc&SAVECOLUMNS ? "Yes" : "No");
str[0]=0;
if(cfg.xedit[i]->misc&QUOTEWRAP) {
......@@ -1869,17 +1869,17 @@ void xedit_cfg()
else
SAFEPRINTF(str, ", for %u columns", (uint)cfg.xedit[i]->quotewrap_cols);
}
sprintf(opt[k++],"%-32.32s%s%s","Word-wrap Quoted Text"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s%s","Word-wrap Quoted Text"
,cfg.xedit[i]->misc&QUOTEWRAP ? "Yes":"No", str);
sprintf(opt[k++],"%-32.32s%s","Automatically Quoted Text"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Automatically Quoted Text"
,cfg.xedit[i]->misc&QUOTEALL ? "All":cfg.xedit[i]->misc&QUOTENONE
? "None" : "Prompt User");
SAFECOPY(str, cfg.xedit[i]->misc&QUICKBBS ? "MSGINF/MSGTMP ": "EDITOR.INF/RESULT.ED");
if(cfg.xedit[i]->misc&XTRN_LWRCASE)
strlwr(str);
sprintf(opt[k++],"%-32.32s%s %s","Editor Information Files"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s %s","Editor Information Files"
,cfg.xedit[i]->misc&QUICKBBS ? "QuickBBS":"WWIV", str);
sprintf(opt[k++],"%-32.32s%s","Expand Line Feeds to CRLF"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Expand Line Feeds to CRLF"
,cfg.xedit[i]->misc&EXPANDLF ? "Yes":"No");
const char* p;
switch(cfg.xedit[i]->soft_cr) {
......@@ -1897,12 +1897,12 @@ void xedit_cfg()
p = "Unspecified";
break;
}
sprintf(opt[k++],"%-32.32s%s","Handle Soft Carriage Returns", p);
sprintf(opt[k++],"%-32.32s%s","Strip FidoNet Kludge Lines"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Handle Soft Carriage Returns", p);
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Strip FidoNet Kludge Lines"
,cfg.xedit[i]->misc&STRIPKLUDGE ? "Yes":"No");
sprintf(opt[k++],"%-32.32s%s","Support UTF-8 Encoding"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","Support UTF-8 Encoding"
,cfg.xedit[i]->misc&XTRN_UTF8 ? "Yes":"No");
sprintf(opt[k++],"%-32.32s%s","BBS Drop File Type"
snprintf(opt[k++],MAX_OPLN,"%-32.32s%s","BBS Drop File Type"
,dropfile(cfg.xedit[i]->type,cfg.xedit[i]->misc));
opt[k][0]=0;
uifc.helpbuf=
......@@ -2308,7 +2308,7 @@ int natvpgm_cfg()
while(1) {
for(i=0;i<MAX_OPTS && i<cfg.total_natvpgms;i++)
sprintf(opt[i],"%-12s",cfg.natvpgm[i]->name);
snprintf(opt[i],MAX_OPLN,"%-12s",cfg.natvpgm[i]->name);
opt[i][0]=0;
j=WIN_ACT|WIN_CHE|WIN_L2R|WIN_SAV;
if(cfg.total_natvpgms)
......@@ -2397,7 +2397,7 @@ void xtrnsec_cfg()
while(1) {
for(i=0;i<cfg.total_xtrnsecs && i<MAX_OPTS;i++)
sprintf(opt[i],"%-*s %5u", (int)sizeof(cfg.xtrn[i]->name)-1, cfg.xtrnsec[i]->name, progs_in_sec(i));
snprintf(opt[i],MAX_OPLN,"%-*s %5u", (int)sizeof(cfg.xtrn[i]->name)-1, cfg.xtrnsec[i]->name, progs_in_sec(i));
opt[i][0]=0;
j=WIN_SAV|WIN_ACT|WIN_CHE|WIN_BOT;
if(cfg.total_xtrnsecs)
......@@ -2513,11 +2513,11 @@ void xtrnsec_cfg()
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27s%s","Name",cfg.xtrnsec[i]->name);
sprintf(opt[k++],"%-27.27s%s","Internal Code",cfg.xtrnsec[i]->code);
sprintf(opt[k++],"%-27.27s%s","Access Requirements"
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Name",cfg.xtrnsec[i]->name);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Internal Code",cfg.xtrnsec[i]->code);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Access Requirements"
,cfg.xtrnsec[i]->arstr);
sprintf(opt[k++],"%s","Online Programs...");
snprintf(opt[k++],MAX_OPLN,"%s","Online Programs...");
opt[k][0]=0;
sprintf(str,"%s Program Section",cfg.xtrnsec[i]->name);
uifc.helpbuf=
......@@ -2602,7 +2602,7 @@ void hotkey_cfg(void)
while(1) {
for(i=0;i<cfg.total_hotkeys && i<MAX_OPTS;i++)
sprintf(opt[i],"Ctrl-%c %s"
snprintf(opt[i],MAX_OPLN,"Ctrl-%c %s"
,cfg.hotkey[i]->key+'@'
,cfg.hotkey[i]->cmd);
opt[i][0]=0;
......@@ -2685,9 +2685,9 @@ void hotkey_cfg(void)
done=0;
while(!done) {
k=0;
sprintf(opt[k++],"%-27.27sCtrl-%c","Global Hot Key"
snprintf(opt[k++],MAX_OPLN,"%-27.27sCtrl-%c","Global Hot Key"
,cfg.hotkey[i]->key+'@');
sprintf(opt[k++],"%-27.27s%s","Command Line",cfg.hotkey[i]->cmd);
snprintf(opt[k++],MAX_OPLN,"%-27.27s%s","Command Line",cfg.hotkey[i]->cmd);
opt[k][0]=0;
uifc.helpbuf=
"`Global Hot Key Event:`\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