]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pcre: fix var capture for non relative matches 1230/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:38:15 +0000 (10:38 +0100)
Var capture setup depended on the match being relative due to a logic
error.

src/detect-pcre.c

index c3261299589f1ae642dd5c116d46447142bbe0bd..0721154c9e1c5ee6e72dd161b943c9080d8c8c43 100644 (file)
@@ -736,6 +736,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;
 
@@ -759,11 +764,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);