]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Coverity 1005133: fix unlikely case where malformed pcre statement in rule would...
authorVictor Julien <victor@inliniac.net>
Fri, 19 Apr 2013 08:02:36 +0000 (10:02 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 19 Apr 2013 08:02:36 +0000 (10:02 +0200)
src/detect-pcre.c

index 6f6049fe85df7e698e2535a41685c1b05d682b20..65bf959706edf559ffcea7ed45b74bf473b085e0 100644 (file)
@@ -288,12 +288,10 @@ DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx, char *regexstr)
 
     ret = pcre_exec(parse_regex, parse_regex_study, regexstr + pos, slen-pos,
                     0, 0, ov, MAX_SUBSTRINGS);
-    if (ret < 0) {
-        SCLogError(SC_ERR_PCRE_MATCH, "parse error");
+    if (ret <= 0) {
+        SCLogError(SC_ERR_PCRE_MATCH, "pcre parse error: %s", regexstr);
         goto error;
-    }
-
-    if (ret > 1) {
+    } else {
         const char *str_ptr;
         res = pcre_get_substring((char *)regexstr + pos, ov, MAX_SUBSTRINGS,
                                  1, &str_ptr);