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

Fix CID 33239: Argument cannot be negative

parent 9169e4aa
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -852,7 +852,7 @@ void sbbs_t::removeline(char *str, char *str2, char num, char skip) ...@@ -852,7 +852,7 @@ void sbbs_t::removeline(char *str, char *str2, char num, char skip)
{ {
char* buf; char* buf;
size_t slen; size_t slen;
int i,file; int i,file;
long l=0,flen; long l=0,flen;
FILE *stream; FILE *stream;
...@@ -861,6 +861,11 @@ void sbbs_t::removeline(char *str, char *str2, char num, char skip) ...@@ -861,6 +861,11 @@ void sbbs_t::removeline(char *str, char *str2, char num, char skip)
return; return;
} }
flen=(long)filelength(file); flen=(long)filelength(file);
if(flen < 0) {
close(file);
errormsg(WHERE, ERR_CHK, str, flen);
return;
}
slen=strlen(str2); slen=strlen(str2);
if((buf=(char *)malloc(flen))==NULL) { if((buf=(char *)malloc(flen))==NULL) {
close(file); close(file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment