From: Victor Julien Date: Mon, 1 Dec 2014 09:36:52 +0000 (+0100) Subject: pcre: fix var capture for non relative matches X-Git-Tag: suricata-2.1beta3~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1231%2Fhead;p=thirdparty%2Fsuricata.git pcre: fix var capture for non relative matches Var capture setup depended on the match being relative due to a logic error. --- 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);