From 4b0d5b375641fec2c73abddb903664db80baac0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Mon, 29 Mar 2021 22:53:45 -0400
Subject: [PATCH] Guard against pathologically bad OO][ sequences.

---
 src/syncterm/ooii.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/syncterm/ooii.c b/src/syncterm/ooii.c
index e3c8199ea8..76c6f45bbf 100644
--- a/src/syncterm/ooii.c
+++ b/src/syncterm/ooii.c
@@ -303,7 +303,7 @@ static void getBlock(unsigned char **codeStr, char *menuBlock)
 	menuBlock[0]=0;
 	if(**codeStr=='_')
 		(*codeStr)++;
-	while(**codeStr != '_' && **codeStr != '|') {
+	while(**codeStr && **codeStr != '_' && **codeStr != '|') {
 		*(menuBlock++) = *((*codeStr)++);
 		*menuBlock=0;
 	}
@@ -345,7 +345,7 @@ static int readSmallMenu(unsigned char *codeStr) {
 	int  yy;
 	int  zz;
 	unsigned char *origCodeStr=codeStr;
-	char buf[256];
+	char buf[260];
 
 	switch ((char)codeStr[0]) {
 		case 'a':
-- 
GitLab