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

Handle filelength() possibly returning negative value

CID 349724
parent aeecca16
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2774 passed
...@@ -1457,7 +1457,7 @@ char* readsmsg(scfg_t* cfg, int usernumber) ...@@ -1457,7 +1457,7 @@ char* readsmsg(scfg_t* cfg, int usernumber)
if((file=nopen(str,O_RDWR))==-1) if((file=nopen(str,O_RDWR))==-1)
return(NULL); return(NULL);
length=(long)filelength(file); length=(long)filelength(file);
if((buf=(char *)malloc(length+1))==NULL) { if(length < 0 || (buf=(char *)malloc(length+1))==NULL) {
close(file); close(file);
return(NULL); return(NULL);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment