From 8003ecfabc2680e35f15633d0084e3657ba6c1e8 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 16 Nov 2023 14:53:25 +0100 Subject: [PATCH 1/2] bugfix: initialize ASL to default value 1 to avoid randomized access rights --- src/gateAs.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gateAs.cc b/src/gateAs.cc index 962347d..af84179 100644 --- a/src/gateAs.cc +++ b/src/gateAs.cc @@ -411,7 +411,6 @@ gateAsEntry* gateAs::findEntryInList(const char* pv, gateAsList& list) const int gateAs::readPvList(const char* lfile) { - int lev; int line=0; FILE* fd; char inbuf[GATE_MAX_PVLIST_LINE_LENGTH]; @@ -448,7 +447,7 @@ int gateAs::readPvList(const char* lfile) // Read all PV file lines while(fgets(inbuf,sizeof(inbuf),fd)) { - + int lev=1; ++line; pattern=rname=hname=NULL; From 7d685c72aea39c15812c1333e91630041e5175f2 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Mon, 3 Jun 2024 09:17:07 +0200 Subject: [PATCH 2/2] fix buffer overrun bug --- src/gateAs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gateAs.cc b/src/gateAs.cc index af84179..c3233e0 100644 --- a/src/gateAs.cc +++ b/src/gateAs.cc @@ -391,7 +391,7 @@ gateAsEntry* gateAs::findEntryInList(const char* pv, gateAsList& list) const int len = (int) strlen(pv); #ifdef USE_PCRE pi->substrings=pcre_exec(pi->pat_buff, NULL, - pv, len, 0, PCRE_ANCHORED, pi->ovector, 30); + pv, len, 0, PCRE_ANCHORED, pi->ovector, pi->ovecsize); if((pi->substrings>=0 && pi->ovector[1] == len) #ifdef USE_NEG_REGEXP ^ pi->negate_pattern