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

load_cfg() now requires the size of the error string buffer passed as argument

parent 5e0f2ad6
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1155 failed
...@@ -76,7 +76,7 @@ void refresh_events(void) ...@@ -76,7 +76,7 @@ void refresh_events(void)
/* Read .cfg files here */ /* Read .cfg files here */
free_cfg(&cfg); free_cfg(&cfg);
if(!load_cfg(&cfg, NULL, TRUE, str)) { if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
char error[256]; char error[256];
SAFEPRINTF(error, "ERROR Loading Configuration Files: %s", str); SAFEPRINTF(error, "ERROR Loading Configuration Files: %s", str);
display_message("Load Error",error,"gtk-dialog-error"); display_message("Load Error",error,"gtk-dialog-error");
......
...@@ -90,7 +90,7 @@ int refresh_globals(void) ...@@ -90,7 +90,7 @@ int refresh_globals(void)
} }
/* Read .cfg files here */ /* Read .cfg files here */
if(!load_cfg(&cfg, NULL, TRUE, str)) { if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
fprintf(stderr,"Cannot load configuration data: %s\n", str); fprintf(stderr,"Cannot load configuration data: %s\n", str);
return(-1); return(-1);
} }
......
...@@ -39,7 +39,7 @@ int main(int argc, char **argv) ...@@ -39,7 +39,7 @@ int main(int argc, char **argv)
} }
cfg.size=sizeof(cfg); cfg.size=sizeof(cfg);
if(!load_cfg(&cfg, NULL, TRUE, str)) { if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
fprintf(stderr,"Cannot load configuration data (%s)",str); fprintf(stderr,"Cannot load configuration data (%s)",str);
return(-1); return(-1);
} }
......
...@@ -496,7 +496,7 @@ void status_thread(void *arg) ...@@ -496,7 +496,7 @@ void status_thread(void *arg)
lprintf(LOG_INFO,"Loading configuration files from %s", scfg.ctrl_dir); lprintf(LOG_INFO,"Loading configuration files from %s", scfg.ctrl_dir);
scfg.size=sizeof(scfg); scfg.size=sizeof(scfg);
SAFECOPY(error,UNKNOWN_LOAD_ERROR); SAFECOPY(error,UNKNOWN_LOAD_ERROR);
if(!load_cfg(&scfg, NULL, TRUE, error)) { if(!load_cfg(&scfg, NULL, TRUE, error, sizeof(error))) {
lprintf(LOG_CRIT,"!ERROR %s",error); lprintf(LOG_CRIT,"!ERROR %s",error);
lprintf(LOG_CRIT,"!Failed to load configuration files"); lprintf(LOG_CRIT,"!Failed to load configuration files");
return; return;
......
...@@ -1945,7 +1945,7 @@ int main(int argc, char** argv) { ...@@ -1945,7 +1945,7 @@ int main(int argc, char** argv) {
memset(&cfg,0,sizeof(cfg)); memset(&cfg,0,sizeof(cfg));
cfg.size=sizeof(cfg); cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir,bbs_startup.ctrl_dir); SAFECOPY(cfg.ctrl_dir,bbs_startup.ctrl_dir);
if(!load_cfg(&cfg, NULL, TRUE, str)) { if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
printf("ERROR! %s\n",str); printf("ERROR! %s\n",str);
exit(1); exit(1);
} }
......
...@@ -892,7 +892,7 @@ int main(int argc, char** argv) { ...@@ -892,7 +892,7 @@ int main(int argc, char** argv) {
memset(&cfg,0,sizeof(cfg)); memset(&cfg,0,sizeof(cfg));
cfg.size=sizeof(cfg); cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir,bbs_startup.ctrl_dir); SAFECOPY(cfg.ctrl_dir,bbs_startup.ctrl_dir);
if(!load_cfg(&cfg, NULL, TRUE, str)) { if(!load_cfg(&cfg, NULL, TRUE, str, sizeof(str))) {
printf("ERROR! %s\n",str); printf("ERROR! %s\n",str);
exit(1); exit(1);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment