From b150def88c33a00b5f6322ad2fc69f989a4f3fb2 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 26 May 2026 18:56:46 +0000 Subject: [PATCH] Limit heap mem per pattern match --- service_scan.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service_scan.cc b/service_scan.cc index 8ea5ce1e6..ec7ff2e48 100644 --- a/service_scan.cc +++ b/service_scan.cc @@ -465,6 +465,9 @@ void ServiceProbeMatch::InitMatch(const char *matchtext, int lineno) { #else pcre2_set_recursion_limit(match_context, 10000); #endif +#ifdef pcre2_set_heap_limit + pcre2_set_heap_limit(match_context, 10); // units = kibibytes +#endif /* OK! Now we look for any templates of the form ?/.../ * where ? is either p, v, i, h, o, or d. / is any