Commit cd20a33c authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Fix CID 33261 Argument cannot be negative

parent bc6e5876
Pipeline #2828 passed with stage
in 9 minutes and 44 seconds
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment