library) from ubuntu Linux (via gentoo). For details see: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2491 Bump PKGREVISION's.
69 lines
1.8 KiB
Text
69 lines
1.8 KiB
Text
$NetBSD: patch-ec,v 1.1 2005/10/01 19:36:01 recht Exp $
|
|
|
|
--- Modules/pypcre.c.orig 2003-10-20 16:34:47.000000000 +0200
|
|
+++ Modules/pypcre.c 2005-10-01 21:13:56.000000000 +0200
|
|
@@ -1163,14 +1163,31 @@
|
|
int min = 0;
|
|
int max = -1;
|
|
|
|
+/* Read the minimum value and do a paranoid check: a negative value indicates
|
|
+an integer overflow. */
|
|
+
|
|
while ((pcre_ctypes[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';
|
|
|
|
+if (min < 0 || min > 65535)
|
|
+ {
|
|
+ *errorptr = ERR5;
|
|
+ return p;
|
|
+ }
|
|
+
|
|
+/* Read the maximum value if there is one, and again do a paranoid on its size
|
|
+. Also, max must not be less than min. */
|
|
+
|
|
if (*p == '}') max = min; else
|
|
{
|
|
if (*(++p) != '}')
|
|
{
|
|
max = 0;
|
|
while((pcre_ctypes[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
|
|
+ if (max < 0 || max > 65535)
|
|
+ {
|
|
+ *errorptr = ERR5;
|
|
+ return p;
|
|
+ }
|
|
if (max < min)
|
|
{
|
|
*errorptr = ERR4;
|
|
@@ -2267,6 +2284,7 @@
|
|
int bracount = 0;
|
|
int brastack[200];
|
|
int top_backref = 0;
|
|
+BOOL capturing;
|
|
unsigned int brastackptr = 0;
|
|
uschar *code;
|
|
const uschar *ptr;
|
|
@@ -2446,6 +2464,7 @@
|
|
/* Brackets may be genuine groups or special things */
|
|
|
|
case '(':
|
|
+ capturing = FALSE;
|
|
|
|
/* Handle special forms of bracket, which all start (? */
|
|
|
|
@@ -2543,10 +2562,15 @@
|
|
continue; /* End of this bracket handling */
|
|
}
|
|
|
|
+ /* Ordinary parentheses, not followed by '?', are capturing unless
|
|
+ PCRE_NO_AUTO_CAPTURE is set. */
|
|
+
|
|
+ else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0;
|
|
+
|
|
/* Extracting brackets must be counted so we can process escapes in a
|
|
Perlish way. */
|
|
|
|
- else bracount++;
|
|
+ if (capturing) bracount++;
|
|
|
|
/* Non-special forms of bracket. Save length for computing whole length
|
|
at end if there's a repeat that requires duplication of the group. */
|