pcre: Fix heap-buffer-overflow when loading invalid filter files
authorFabian Keil <fk@fabiankeil.de>
Sun, 8 May 2016 10:47:49 +0000 (10:47 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 8 May 2016 10:47:49 +0000 (10:47 +0000)
Found with afl-fuzz and ASAN.
Not considered a security vulnerability as filter files are trusted input.

pcre/pcre.c

index 38d0113..5824040 100644 (file)
@@ -2660,8 +2660,13 @@ while ((c = *(++ptr)) != 0)
         }
       else class_charcount++;
       ptr++;
         }
       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 */
 
 
     /* Repeats for negated single chars are handled by the general code */