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

A couple more sprintf->SAFEPRINTF conversions

Not sure why, as this utility has been deprecated. :-/
parent 4e3e63ef
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2571 passed
...@@ -85,7 +85,7 @@ void updatestats(ulong size) ...@@ -85,7 +85,7 @@ void updatestats(ulong size)
int file; int file;
uint32_t l; uint32_t l;
sprintf(str,"%sdsts.dab",scfg.ctrl_dir); SAFEPRINTF(str,"%sdsts.dab",scfg.ctrl_dir);
if((file=nopen(str,O_RDWR|O_BINARY))==-1) { if((file=nopen(str,O_RDWR|O_BINARY))==-1) {
printf("ERR_OPEN %s\n",str); printf("ERR_OPEN %s\n",str);
return; return;
...@@ -170,7 +170,7 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s ...@@ -170,7 +170,7 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s
dir=opendir(str); dir=opendir(str);
while(dir!=NULL && (dirent=readdir(dir))!=NULL) { while(dir!=NULL && (dirent=readdir(dir))!=NULL) {
sprintf(filepath, "%s%s" SAFEPRINTF2(filepath, "%s%s"
,scfg.dir[dirnum]->path ,scfg.dir[dirnum]->path
,dirent->d_name); ,dirent->d_name);
if(isdir(filepath)) if(isdir(filepath))
...@@ -264,7 +264,7 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s ...@@ -264,7 +264,7 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s
if((stream=fopen(listpath,"r"))==NULL) { if((stream=fopen(listpath,"r"))==NULL) {
fprintf(stderr,"Error %d (%s) opening %s\n" fprintf(stderr,"Error %d (%s) opening %s\n"
,errno,strerror(errno),listpath); ,errno,strerror(errno),listpath);
sprintf(listpath,"%s%s", scfg.dir[dirnum]->path,inpath); SAFEPRINTF2(listpath, "%s%s", scfg.dir[dirnum]->path, inpath);
fexistcase(listpath); fexistcase(listpath);
if((stream=fopen(listpath,"r"))==NULL) { if((stream=fopen(listpath,"r"))==NULL) {
printf("Can't open: %s\n" printf("Can't open: %s\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment