pcre: Fix heap-buffer-overflow when loading invalid filter files
[privoxy.git] / pcre / pcre.c
index 1e602df..5824040 100644 (file)
@@ -2660,8 +2660,13 @@ while ((c = *(++ptr)) != 0)
         }
       else class_charcount++;
       ptr++;
+      if (*ptr == 0)
+        {
+        *errorptr = ERR6;
+        goto PCRE_ERROR_RETURN;
+        }
       }
-    while (*ptr != 0 && *ptr != ']');
+    while (*ptr != ']');
 
     /* Repeats for negated single chars are handled by the general code */
 
@@ -3018,11 +3023,6 @@ while ((c = *(++ptr)) != 0)
         *errorptr = "internal error";
         goto PCRE_ERROR_RETURN;
         }
-      if ((int)ptr[1] >= tables_length - ctypes_offset)
-        {
-        *errorptr = ERR6;
-        goto PCRE_ERROR_RETURN;
-        }
       }
 
     /* This "while" is the end of the "do" above. */