From ca9f6f09e530b20d94c80bcac54bfcf5abfc7b39 Mon Sep 17 00:00:00 2001
From: anonymouspage <123-anonymouspage@users.noreply.gitlab.synchro.net>
Date: Tue, 18 Oct 2022 13:34:32 -0700
Subject: [PATCH] checkStamp: prevent array size promotion/truncation

Calls to checkStamp are passing literals that are not 20 bytes
in size. This causes a "promotion" of the size in the context
of checkStamp. We can quiet these warnings by just marking the
parameter as a pointer.

Note: a safer approach would be to pass a pointer and length.

This was detected by gcc 11.2.0:

ooii.c:1018:9: error: 'checkStamp' accessing 20 bytes in a region of size 11 [-Werror=stringop-overflow=]
...
---
 src/syncterm/ooii.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/syncterm/ooii.c b/src/syncterm/ooii.c
index 4bed22d04d..e927bc7d24 100644
--- a/src/syncterm/ooii.c
+++ b/src/syncterm/ooii.c
@@ -981,7 +981,7 @@ static int readSmallMenu(unsigned char *codeStr) {
 	return(codeStr-origCodeStr);;
 }
 
-static void checkStamp(int xx,int yy,char stampStr[20]) {  // used w/ incomingCheck
+static void checkStamp(int xx,int yy,char *stampStr) {  // used w/ incomingCheck
 	term_gotoxy(xx+1, yy+1);
 	term_setattr(LIGHTCYAN);
 	cterm_write(cterm, stampStr, -1, NULL, 0, NULL);
-- 
GitLab