From 53d74e7f89770349cbc1d2d28a2d833b899b5f58 Mon Sep 17 00:00:00 2001
From: Alam Ed Arias <alam@srb2.org>
Date: Tue, 20 Feb 2024 11:48:59 -0500
Subject: [PATCH] Clean up stringop-overflow=4 warnings

---
 src/CMakeLists.txt         | 2 --
 src/Makefile.d/versions.mk | 2 --
 src/f_finale.c             | 5 ++---
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 160174080c..5ddb5f7267 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -311,10 +311,8 @@ target_compile_options(SRB2SDL2 PRIVATE
 		$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,8.1.0>:
 			-Wno-error=format-overflow
 			-Wno-error=stringop-truncation
-			-Wno-error=stringop-overflow
 			-Wno-format-overflow
 			-Wno-stringop-truncation
-			-Wno-stringop-overflow
 			-Wno-error=multistatement-macros
 		>
 
diff --git a/src/Makefile.d/versions.mk b/src/Makefile.d/versions.mk
index b639ad9a13..395bba6979 100644
--- a/src/Makefile.d/versions.mk
+++ b/src/Makefile.d/versions.mk
@@ -136,10 +136,8 @@ endif
 ifdef GCC81
  WFLAGS+=-Wno-error=format-overflow
  WFLAGS+=-Wno-error=stringop-truncation
- WFLAGS+=-Wno-error=stringop-overflow
  WFLAGS+=-Wno-format-overflow
  WFLAGS+=-Wno-stringop-truncation
- WFLAGS+=-Wno-stringop-overflow
  WFLAGS+=-Wno-error=multistatement-macros
 endif
 
diff --git a/src/f_finale.c b/src/f_finale.c
index edeb08820c..b19e5eb475 100644
--- a/src/f_finale.c
+++ b/src/f_finale.c
@@ -4384,11 +4384,10 @@ void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum
 	if (!tag || !tag[0])
 		return;
 
-	strncpy(suffixedtag, tag, 33);
-	suffixedtag[32] = 0;
+	strncpy(suffixedtag, tag, sizeof(suffixedtag)-1);
 
 	if (tutorialmode)
-		suffixed = F_GetTextPromptTutorialTag(suffixedtag, 33);
+		suffixed = F_GetTextPromptTutorialTag(suffixedtag, sizeof(suffixedtag)-1);
 
 	for (*promptnum = 0 + tutorialpromptnum; *promptnum < MAX_PROMPTS; (*promptnum)++)
 	{
-- 
GitLab