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

Fix CID 33261 Argument cannot be negative

parent bc6e5876
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2828 passed
......@@ -132,24 +132,26 @@ void sbbs_t::sif(char *fname, char *answers, long len)
int file;
long length,l=0,m,top,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) {
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);
free(buf);
errormsg(WHERE,ERR_READ,str,length);
answers[0]=0;
return;
}
close(file);
......
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