summaryrefslogtreecommitdiffstats
path: root/src/detect-parse.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-24 01:56:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-24 01:56:35 +0000
commitea7b101b409c45955f5d5446bb3bfdf7758b9226 (patch)
treeaca5d4fbf94bc524c392a5dd9cf4571f3a29ccb8 /src/detect-parse.c
parentAdding upstream version 1:7.0.4. (diff)
downloadsuricata-ea7b101b409c45955f5d5446bb3bfdf7758b9226.tar.xz
suricata-ea7b101b409c45955f5d5446bb3bfdf7758b9226.zip
Adding upstream version 1:7.0.5.upstream/1%7.0.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/detect-parse.c')
-rw-r--r--src/detect-parse.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/detect-parse.c b/src/detect-parse.c
index c3232b9..5dee7e6 100644
--- a/src/detect-parse.c
+++ b/src/detect-parse.c
@@ -2701,7 +2701,7 @@ int DetectParsePcreExec(DetectParseRegex *parse_regex, pcre2_match_data **match,
*match = pcre2_match_data_create_from_pattern(parse_regex->regex, NULL);
if (*match)
return pcre2_match(parse_regex->regex, (PCRE2_SPTR8)str, strlen(str), options, start_offset,
- *match, NULL);
+ *match, parse_regex->context);
return -1;
}
@@ -2761,8 +2761,16 @@ bool DetectSetupParseRegexesOpts(const char *parse_str, DetectParseRegex *detect
parse_str, en, errbuffer);
return false;
}
- detect_parse->match = pcre2_match_data_create_from_pattern(detect_parse->regex, NULL);
+ detect_parse->context = pcre2_match_context_create(NULL);
+ if (detect_parse->context == NULL) {
+ SCLogError("pcre2 could not create match context");
+ pcre2_code_free(detect_parse->regex);
+ detect_parse->regex = NULL;
+ return false;
+ }
+ pcre2_set_match_limit(detect_parse->context, SC_MATCH_LIMIT_DEFAULT);
+ pcre2_set_recursion_limit(detect_parse->context, SC_MATCH_LIMIT_RECURSION_DEFAULT);
DetectParseRegexAddToFreeList(detect_parse);
return true;