]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix pcre_study error check
authorVictor Julien <victor@inliniac.net>
Tue, 19 Nov 2013 08:37:16 +0000 (09:37 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 19 Nov 2013 08:37:16 +0000 (09:37 +0100)
pcre_study returning NULL is not necessarily an error, from the man page
pcre_study(3):

  "If the function returns NULL, either it could not find any additional
   information, or there was an error. You can tell the difference by
   looking at the error value. It is NULL in first case."

Older libpcre versions would return NULL, causing errors.

src/detect-ipproto.c

index f03b71b2c77b6b5c3f8b68bf2a47f562265e2c47..a71444785ff001ce1726083e1d50706c8419d60b 100644 (file)
@@ -81,8 +81,8 @@ void DetectIPProtoRegister(void)
     }
 
     parse_regex_study = pcre_study(parse_regex, 0, &eb);
-    if (parse_regex_study == NULL || eb != NULL) {
-        SCLogError(SC_ERR_PCRE_STUDY, "pcre study failed: %s", eb ? eb : "unknown");
+    if (eb != NULL) {
+        SCLogError(SC_ERR_PCRE_STUDY, "pcre study failed: %s", eb);
         goto error;
     }