[sr-dev] git:master: modules/lcr, modules_k/regex: Fix stack overflow from pcre_fullinfo(PCRE_INFO_SIZE)

Richard Fuchs rfuchs at sipwise.com
Mon Aug 13 19:13:57 CEST 2012


Module: sip-router
Branch: master
Commit: 87742f9cd82a7da2da2cab59ea4e6338c76fa3c0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=87742f9cd82a7da2da2cab59ea4e6338c76fa3c0

Author: Richard Fuchs <rfuchs at sipwise.com>
Committer: Richard Fuchs <rfuchs at sipwise.com>
Date:   Mon Aug 13 13:10:37 2012 -0400

modules/lcr, modules_k/regex: Fix stack overflow from pcre_fullinfo(PCRE_INFO_SIZE)

Fix instances where pcre_fullinfo(PCRE_INFO_SIZE) was given only an "int"
argument, which results in stack overflow on some 64-bit platforms where
an "int" is only 32 bits long. It expects a "size_t" argument, which is
64 bits long.

---

 modules/lcr/lcr_mod.c       |    3 ++-
 modules_k/regex/regex_mod.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/lcr/lcr_mod.c b/modules/lcr/lcr_mod.c
index 6627b43..6574229 100644
--- a/modules/lcr/lcr_mod.c
+++ b/modules/lcr/lcr_mod.c
@@ -758,7 +758,8 @@ static pcre *reg_ex_comp(const char *pattern)
 {
     pcre *re, *result;
     const char *error;
-    int rc, size, err_offset;
+    int rc, err_offset;
+    size_t size;
 
     re = pcre_compile(pattern, 0, &error, &err_offset, NULL);
     if (re == NULL) {
diff --git a/modules_k/regex/regex_mod.c b/modules_k/regex/regex_mod.c
index 51665aa..eb9f744 100644
--- a/modules_k/regex/regex_mod.c
+++ b/modules_k/regex/regex_mod.c
@@ -260,7 +260,7 @@ static int load_pcres(int action)
 	char line[FILE_MAX_LINE];
 	char **patterns = NULL;
 	pcre *pcre_tmp = NULL;
-	int pcre_size;
+	size_t pcre_size;
 	int pcre_rc;
 	const char *pcre_error;
 	int pcre_erroffset;




More information about the sr-dev mailing list