From a82559e327b74c4513751593c8e086f67a885355 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 4 Jun 2022 20:33:30 -0700
Subject: [PATCH] Use safe string formatting to squelch warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Attempt to address 2 GCC version 11.2.0 2 warnings reported by Nelgin
ā€˜%s’ directive writing up to 3 bytes into a region of size between 1 and 4097
---
 src/sbbs3/websrvr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c
index 89887ba9f8..e135e1b247 100644
--- a/src/sbbs3/websrvr.c
+++ b/src/sbbs3/websrvr.c
@@ -1542,12 +1542,12 @@ static void send_error(http_session_t * session, unsigned line, const char* mess
 	}
 	if(!sent_ssjs) {
 		if(session->req.error_dir) {
-			sprintf(session->req.physical_path,"%s%s.html",session->req.error_dir,error_code);
+			SAFEPRINTF2(session->req.physical_path,"%s%s.html",session->req.error_dir,error_code);
 			if(stat(session->req.physical_path,&sb))
-				sprintf(session->req.physical_path,"%s%s.html",error_dir,error_code);
+				SAFEPRINTF2(session->req.physical_path,"%s%s.html",error_dir,error_code);
 		}
 		else
-			sprintf(session->req.physical_path,"%s%s.html",error_dir,error_code);
+			SAFEPRINTF2(session->req.physical_path,"%s%s.html",error_dir,error_code);
 		session->req.mime_type=get_mime_type(strrchr(session->req.physical_path,'.'));
 		send_headers(session,message,FALSE);
 		if(!stat(session->req.physical_path,&sb)) {
-- 
GitLab