]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r233493 from trunk:
authorJoe Orton <jorton@apache.org>
Wed, 21 Sep 2005 08:51:11 +0000 (08:51 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 21 Sep 2005 08:51:11 +0000 (08:51 +0000)
* srclib/pcre/pcre.c (read_repeat_counts): Check for integer overflow.

Obtained from: pcre 6.2 upstream
Reviewed by: jorton, nd, wrowe

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@290658 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
srclib/pcre/pcre.c

diff --git a/CHANGES b/CHANGES
index 696ad2afc8df736e26d0aa001af2453d7d473a8e..16fc6c14dd9772fefe004ef97c6a8d9054f38098 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.0.55
 
+  *) SECURITY: CAN-2005-2491 (cve.mitre.org): 
+     Fix integer overflows in PCRE in quantifier parsing which could
+     be triggered by a local user through use of a carefully-crafted 
+     regex in an .htaccess file.  [Philip Hazel]
+
   *) SECURITY: CAN-2005-2088 (cve.mitre.org)
      proxy: Correctly handle the Transfer-Encoding and Content-Length
      headers.  Discard the request Content-Length whenever T-E: chunked
diff --git a/STATUS b/STATUS
index 8964f61ae6b073c0c5d7fb0ead875384df6a19f8..a67d54ec30b1359d1ca50f7b991976b81893ecfc 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -171,12 +171,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
        +1: pquerna, nd, wrowe
        Votes from before the integration branch: +1: jerenkrantz
 
-    *) Fix CAN-2005-2491, integer overflow in pcre.
-         http://svn.apache.org/viewcvs?rev=233493&view=rev
-       rediff for 2.0: http://people.apache.org/~jorton/CAN-2005-2491.patch
-       test case: perl-framework/t/security/CAN-2005-2491.t
-       +1: jorton, nd, wrowe
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ please place SVN revisions from trunk here, so it is easy to
     identify exactly what the proposed changes are!  Add all new
index ad3ddc7c57377b0e4ea571853e1e430060783f13..56e1b1064989fdd651ecc9f98a7526d53788df7e 100644 (file)
@@ -714,7 +714,18 @@ read_repeat_counts(const uschar *p, int *minp, int *maxp,
 int min = 0;
 int max = -1;
 
+/* Read the minimum value and do a paranoid check: a negative value indicates
+an integer overflow. */
+
 while ((cd->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
   {
@@ -722,6 +733,11 @@ if (*p == '}') max = min; else
     {
     max = 0;
     while((cd->ctypes[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
+    if (max < 0 || max > 65535)
+      {
+      *errorptr = ERR5;
+      return p;
+      }
     if (max < min)
       {
       *errorptr = ERR4;
@@ -730,16 +746,11 @@ if (*p == '}') max = min; else
     }
   }
 
-/* Do paranoid checks, then fill in the required variables, and pass back the
-pointer to the terminating '}'. */
+/* Fill in the required variables, and pass back the pointer to the terminating
+'}'. */
 
-if (min > 65535 || max > 65535)
-  *errorptr = ERR5;
-else
-  {
-  *minp = min;
-  *maxp = max;
-  }
+*minp = min;
+*maxp = max;
 return p;
 }