From 79226459e28abf39bb254fe78be4601c476d1668 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 5 Jul 2012 14:27:30 +0000 Subject: - Fix dansguardian to run with new versions of pcre - Bump PORTREVISION Submitted by: Anthony Brown --- www/dansguardian/Makefile | 2 +- www/dansguardian/files/patch-src__RegEx.cpp | 40 ++++++++++++++++++++++++++++ www/dansguardian/files/patch-src__RegExp.hpp | 10 +++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 www/dansguardian/files/patch-src__RegEx.cpp create mode 100644 www/dansguardian/files/patch-src__RegExp.hpp (limited to 'www/dansguardian') diff --git a/www/dansguardian/Makefile b/www/dansguardian/Makefile index 370d5db7b65c..e3a57061eaa1 100644 --- a/www/dansguardian/Makefile +++ b/www/dansguardian/Makefile @@ -7,7 +7,7 @@ PORTNAME= dansguardian PORTVERSION= 2.10.1.1 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= www MASTER_SITES= # empty, see below diff --git a/www/dansguardian/files/patch-src__RegEx.cpp b/www/dansguardian/files/patch-src__RegEx.cpp new file mode 100644 index 000000000000..59c433265200 --- /dev/null +++ b/www/dansguardian/files/patch-src__RegEx.cpp @@ -0,0 +1,40 @@ +--- src/RegExp.cpp.orig 2008-11-18 11:27:04.000000000 +0000 ++++ src/RegExp.cpp 2012-07-05 09:03:46.555469692 +0100 +@@ -161,14 +161,17 @@ + offsets.clear(); + lengths.clear(); + imatched = false; +- regmatch_t *pmatch = new regmatch_t[reg.re_nsub + 1]; // to hold result ++ int num_sub_expressions = MAX_SUB_EXPRESSIONS; ++ if(reg.re_nsub < num_sub_expressions) ++ num_sub_expressions = reg.re_nsub; ++ regmatch_t *pmatch = new regmatch_t[num_sub_expressions + 1]; // to hold result + if (!pmatch) { // if it failed + delete[]pmatch; + imatched = false; + return false; + // exception? + } +- if (regexec(®, pos, reg.re_nsub + 1, pmatch, 0)) { // run regex ++ if (regexec(®, pos, num_sub_expressions + 1, pmatch, 0)) { // run regex + delete[]pmatch; + imatched = false; + // #ifdef DGDEBUG +@@ -182,7 +185,7 @@ + int error = 0; + while (error == 0) { + largestoffset = 0; +- for (i = 0; i <= (signed) reg.re_nsub; i++) { ++ for (i = 0; i <= (signed) num_sub_expressions; i++) { + if (pmatch[i].rm_so != -1) { + matchlen = pmatch[i].rm_eo - pmatch[i].rm_so; + submatch = new char[matchlen + 1]; +@@ -199,7 +202,7 @@ + } + if (largestoffset > 0) { + pos += largestoffset; +- error = regexec(®, pos, reg.re_nsub + 1, pmatch, REG_NOTBOL); ++ error = regexec(®, pos, num_sub_expressions + 1, pmatch, REG_NOTBOL); + } else { + error = -1; + } diff --git a/www/dansguardian/files/patch-src__RegExp.hpp b/www/dansguardian/files/patch-src__RegExp.hpp new file mode 100644 index 000000000000..a16451789087 --- /dev/null +++ b/www/dansguardian/files/patch-src__RegExp.hpp @@ -0,0 +1,10 @@ +--- src/RegExp.hpp.orig 2008-11-18 11:27:04.000000000 +0000 ++++ src/RegExp.hpp 2012-07-05 09:03:46.555469692 +0100 +@@ -22,6 +22,7 @@ + #ifndef __HPP_REGEXP + #define __HPP_REGEXP + ++#define MAX_SUB_EXPRESSIONS 1024 + + // INCLUDES + -- cgit v1.2.3