diff --git a/src/sbbs3/netmail.cpp b/src/sbbs3/netmail.cpp index e8a3e6ae68ca8994e07eb6dc74f1f667c3bb7390..abbdf0e219f35207fac1e87bc772bb5d4aa93a56 100644 --- a/src/sbbs3/netmail.cpp +++ b/src/sbbs3/netmail.cpp @@ -273,6 +273,11 @@ bool sbbs_t::netmail(const char *into, const char *title, long mode, smb_t* resm return(false); } length=(long)filelength(file); + if(length < 0) { + close(file); + errormsg(WHERE, ERR_LEN, msgpath, length); + return false; + } if((buf=(char *)calloc(1, length+1))==NULL) { close(file); errormsg(WHERE,ERR_ALLOC,str,length);