From 935afe75ac88dd8094e58e71e63a9eb566d4efcb Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Thu, 9 Jan 2025 18:52:28 -0800
Subject: [PATCH] Fix buffer overflow when upop() is called with a string > 73
 chars

result in segfault (e.g. adding long filenames using fileman.js)
---
 src/uifc/uifc32.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c
index d969e1b2b5..49d3ec0bec 100644
--- a/src/uifc/uifc32.c
+++ b/src/uifc/uifc32.c
@@ -2752,6 +2752,8 @@ void upop(const char *str)
 	if(!width)
 		return;
 	width += 7;
+	if(width > 80)
+		width = 80;
 	vmem_gettext((api->scrn_width-width+1)/2+1,(api->scrn_len-3+1)/2+1
 			,(api->scrn_width+width-1)/2+1,(api->scrn_len+3-1)/2+1,sav);
 	for(i=0; i < width*3; i++)
-- 
GitLab