From b1bb5630000e4065a9377f1bfaebcf23e6933ccc Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Thu, 24 Feb 2022 12:42:58 -0800 Subject: [PATCH] Handle filelength() possibly returning negative value CID 349724 --- src/sbbs3/userdat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbbs3/userdat.c b/src/sbbs3/userdat.c index 4cd3e95236..d9dba8d46a 100644 --- a/src/sbbs3/userdat.c +++ b/src/sbbs3/userdat.c @@ -1457,7 +1457,7 @@ char* readsmsg(scfg_t* cfg, int usernumber) if((file=nopen(str,O_RDWR))==-1) return(NULL); length=(long)filelength(file); - if((buf=(char *)malloc(length+1))==NULL) { + if(length < 0 || (buf=(char *)malloc(length+1))==NULL) { close(file); return(NULL); } -- GitLab