From f3d85b1593a1d32f1197b8825817ceed6fbcc2b9 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sun, 2 Oct 2005 21:56:29 +0000
Subject: [PATCH] Bug-fixes in ARS compilation: Wasn't accounting for correct
 lengths of keywords: WIN32, UNIX, LINUX, and PROT Didn't support >8 char
 internal codes in SUBCODE and DIRCODE values Would skip pass the line (null)
 terminator causing stack corruption or crash when parsing values for SUBCODE,
 DIRCODE, or SHELL keywords as the last keyword.

---
 src/sbbs3/ars.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/sbbs3/ars.c b/src/sbbs3/ars.c
index c01208fa3c..70caa71d1a 100644
--- a/src/sbbs3/ars.c
+++ b/src/sbbs3/ars.c
@@ -270,28 +270,28 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
 					ar[j++]=AR_NOT;
 				not=0;
 				ar[j++]=artype;
-				i+=2; }
+				i+=4; }
 			else if(!strnicmp(str+i,"UNIX",4)) {
 				artype=AR_UNIX;
 				if(not)
 					ar[j++]=AR_NOT;
 				not=0;
 				ar[j++]=artype;
-				i+=2; }
+				i+=3; }
 			else if(!strnicmp(str+i,"LINUX",5)) {
 				artype=AR_LINUX;
 				if(not)
 					ar[j++]=AR_NOT;
 				not=0;
 				ar[j++]=artype;
-				i+=2; }
+				i+=4; }
 			else if(!strnicmp(str+i,"PROT",4)) {
 				artype=AR_PROT;
 				if(not)
 					ar[j++]=AR_NOT;
 				not=0;
 				ar[j++]=artype;
-				i+=2; }
+				i+=3; }
 			else if(!strnicmp(str+i,"SUBCODE",7)) {
 				artype=AR_SUBCODE;
 				i+=6; }
@@ -498,7 +498,7 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
 			while(isdigit(str[i+1])) i++;
 			continue; }
 		if(artype==AR_SUBCODE || artype==AR_DIRCODE || artype==AR_SHELL) {
-			for(n=0;n<8
+			for(n=0;n<LEN_EXTCODE
 				&& str[i]
 				&& str[i]!=' '
 				&& str[i]!='('
@@ -508,7 +508,9 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
 				;n++)
 				ar[j++]=toupper(str[i++]);
 			ar[j++]=0;
-			continue; }
+			i--;
+			continue; 
+		}
 		switch(artype) {
 			case AR_FLAG1:
 			case AR_FLAG2:
-- 
GitLab