From 73e93cccbe15a3f974b3decee82ba1c3736bb145 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sun, 15 Mar 2020 19:54:07 +0000
Subject: [PATCH] Log files can be very big. Let's not allocate the space for
 them on the stack. Use the heap instead.

---
 src/sbbs3/umonitor/umonitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/umonitor/umonitor.c b/src/sbbs3/umonitor/umonitor.c
index 2c5985558d..5790d5ecb6 100644
--- a/src/sbbs3/umonitor/umonitor.c
+++ b/src/sbbs3/umonitor/umonitor.c
@@ -410,11 +410,12 @@ int view_log(char *filename, char *title)
 	if(fexist(filename)) {
 		if((buffile=sopen(filename,O_RDONLY,SH_DENYWR))>=0) {
 			j=filelength(buffile);
-			if((buf=(char *)alloca(j+1))!=NULL) {
+			if(j >= 0 && (buf=(char *)malloc(j+1))!=NULL) {
 				read(buffile,buf,j);
 				close(buffile);
 				*(buf+j)=0;
 				uifc.showbuf(WIN_MID,0,0,76,uifc.scrn_len-2,title,buf,NULL,NULL);
+				free(buf);
 				return(0);
 			}
 			close(buffile);
-- 
GitLab