From 18efc80bdd65b59111056275588cc819a99c03fd Mon Sep 17 00:00:00 2001 From: Marc Stern Date: Mon, 21 Aug 2023 10:30:36 +0200 Subject: [PATCH] Double memory allocation: 'current_targets' is allocated in ruleset->mp. 'rule->p1' is a copy of current_targets, but we strdup it in the same memory pool as 'current_targets'. So, simply assign 'current_targets' to 'rule->p1'. --- apache2/re.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apache2/re.c b/apache2/re.c index 9ded3be7..aafb2b5a 100644 --- a/apache2/re.c +++ b/apache2/re.c @@ -499,7 +499,7 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r if(var_appended == 1) { current_targets = msre_generate_target_string(ruleset->mp, rule); rule->unparsed = msre_rule_generate_unparsed(ruleset->mp, rule, current_targets, NULL, NULL); - rule->p1 = apr_pstrdup(ruleset->mp, current_targets); + rule->p1 = current_targets; if(msr) { msr_log(msr, 9, "Successfully appended variable"); }