]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pcre: fix var capture for non relative matches 1231/head
authorVictor Julien <victor@inliniac.net>
Mon, 1 Dec 2014 09:36:52 +0000 (10:36 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 1 Dec 2014 09:36:52 +0000 (10:36 +0100)
Var capture setup depended on the match being relative due to a logic
error.

src/detect-pcre.c

index d87bc5cb05555dc6ec6808d6486c81406cc8f798..1c649f21ff18c8ae43b319ed1353c46379b8d4fc 100644 (file)
@@ -737,6 +737,11 @@ static int DetectPcreSetup (DetectEngineCtx *de_ctx, Signature *s, char *regexst
     sm->ctx = (void *)pd;
     SigMatchAppendSMToList(s, sm, sm_list);
 
+    if (pd->capidx != 0) {
+        if (DetectFlowvarPostMatchSetup(s, pd->capidx) < 0)
+            goto error_nofree;
+    }
+
     if (!(pd->flags & DETECT_PCRE_RELATIVE))
         goto okay;
 
@@ -760,11 +765,6 @@ static int DetectPcreSetup (DetectEngineCtx *de_ctx, Signature *s, char *regexst
         tmp->flags |= DETECT_PCRE_RELATIVE_NEXT;
     }
 
-    if (pd->capidx != 0) {
-        if (DetectFlowvarPostMatchSetup(s, pd->capidx) < 0)
-            goto error_nofree;
-    }
-
  okay:
     ret = 0;
     SCReturnInt(ret);