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

Fix CID 33227: Argument cannot be negative

parent 5051ad34
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -302,23 +302,26 @@ void sbbs_t::sof(char *fname, char *answers, long len)
int file;
long length,l=0,m,a=0;
*answers = '\0';
sprintf(str,"%s%s.sif",cfg.text_dir,fname);
if((file=nopen(str,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_RDONLY);
answers[0]=0;
return;
}
length=(long)filelength(file);
if(length < 0) {
close(file);
errormsg(WHERE, ERR_CHK, str, length);
return;
}
if((buf=(char *)calloc(length + 1, 1))==0) {
close(file);
errormsg(WHERE,ERR_ALLOC,str,length);
answers[0]=0;
return;
}
if(lread(file,buf,length)!=length) {
close(file);
errormsg(WHERE,ERR_READ,str,length);
answers[0]=0;
free(buf);
return;
}
......
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