From aaa5737e8b98becf3387831f0c10781f336fc12c Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sat, 2 May 2020 06:09:38 +0000 Subject: [PATCH] Keep Deuce from killing Vert by viewing 16GB log files: Don't use P_OPENCLOSE printfile() mode for any files > 2MB in size. --- src/sbbs3/prntfile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sbbs3/prntfile.cpp b/src/sbbs3/prntfile.cpp index 5cba2ab3e3..39026e7be9 100644 --- a/src/sbbs3/prntfile.cpp +++ b/src/sbbs3/prntfile.cpp @@ -42,6 +42,9 @@ #ifndef PRINTFILE_MAX_LINE_LEN #define PRINTFILE_MAX_LINE_LEN (1024*1024) #endif +#ifndef PRINTFILE_MAX_FILE_LEN +#define PRINTFILE_MAX_FILE_LEN (1024*1024*2) +#endif /****************************************************************************/ /* Prints a file remotely and locally, interpreting ^A sequences, checks */ @@ -105,7 +108,7 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols, JSObject* ob return true; } - if(mode&P_OPENCLOSE) { + if((mode&P_OPENCLOSE) && length <= PRINTFILE_MAX_FILE_LEN) { if((buf=(char*)malloc(length+1L))==NULL) { fclose(stream); errormsg(WHERE,ERR_ALLOC,fpath,length+1L); -- GitLab