From ee8da21e3626bc02b878a0523f9f6294d134ff05 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 1 Dec 2014 10:36:52 +0100 Subject: [PATCH] pcre: fix var capture for non relative matches Var capture setup depended on the match being relative due to a logic error. --- src/detect-pcre.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/detect-pcre.c b/src/detect-pcre.c index d87bc5cb05..1c649f21ff 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -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); -- 2.47.2