From 105627890fa49ca6a61984089618cea00d433d96 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Fri, 13 Sep 2024 12:38:45 -0700
Subject: [PATCH] Eliminte weird gcc (12.2) warning in release build (only)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Increasing size of mode[] element by 2 bytes eliminated these GCC warnings
that seem like false-positives to me:

sbbs.h:194:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  194 |                                 (ret)[JSSTSpos]=(char)JSSTSstrval[JSSTSpos]; \
      |                                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
js_file.c:225:25: note: in expansion of macro ‘JSSTRING_TO_STRBUF’
  225 |                         JSSTRING_TO_STRBUF(cx, str, p->mode, sizeof(p->mode), NULL);
      |                         ^~~~~~~~~~~~~~~~~~
js_file.c:42:17: note: at offset 5 into destination object ‘mode’ of size 5
   42 |         char    mode[5];
      |                 ^~~~

Similar use of JSSTRING_TO_STRBUF in other files (js_console.cpp, js_archive.c)
(with larger target buffers) does not trigger the same warnings.
---
 src/sbbs3/js_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sbbs3/js_file.c b/src/sbbs3/js_file.c
index 5dab06577a..949a63eb58 100644
--- a/src/sbbs3/js_file.c
+++ b/src/sbbs3/js_file.c
@@ -39,7 +39,7 @@ typedef struct
 {
 	FILE*	fp;
 	char	name[MAX_PATH+1];
-	char	mode[5];
+	char	mode[7];
 	uchar	etx;
 	BOOL	debug;
 	BOOL	rot13;
-- 
GitLab